Ejemplo n.º 1
0
        public override bool Run()
        {
            try
            {
                StateMachineClient client = StateMachineClient.Acquire(Actor, "single_animation");
                client.SetActor("x", Actor);
                client.EnterState("x", "Enter");

                Definition definition = InteractionDefinition as Definition;

                Sim.AnimationClipDataForCAS rcas = definition.mAnimation;

                while (!Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                {
                    if (!AnimationTone.ControlLoop(this))
                    {
                        break;
                    }

                    client.SetParameter("AnimationClip", rcas.AnimationClipName, rcas.ProductVersion);
                    client.RequestState("x", "Animate");
                    client.RequestState(false, "x", "Enter");
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }
            return(false);
        }
        public override bool Run()
        {
            try
            {
                mCurrentStateMachine = StateMachineClient.Acquire(Target, "single_looping_animation");
                mCurrentStateMachine.SetActor(mActorName, Target);
                mCurrentStateMachine.EnterState(mActorName, "EnterExit");

                Definition interactionDefinition = InteractionDefinition as Definition;

                mCurrentStateMachine.AddPersistentStateEnteredEventHandler("Animate", new SacsEventHandler(Looped));

                mCurrentStateMachine.SetParameter("AnimationClip", interactionDefinition.ClipName, interactionDefinition.mProductVersion);
                mCurrentStateMachine.RequestState(mActorName, "Animate");
                DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                mCurrentStateMachine.RequestState(mActorName, "EnterExit");
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }
            return(false);
        }
Ejemplo n.º 3
0
        public override bool Run()
        {
            try
            {
                mCurrentStateMachine = StateMachineClient.Acquire(Target, "Mirror", AnimationPriority.kAPDefault);
                mCurrentStateMachine.SetActor("x", Target);
                mCurrentStateMachine.EnterState("x", "StepInFrontOfMirror");
                AnimateSim("ChangeAppearance");

                new Sims.Dresser().Perform(new GameHitParameters <GameObject>(Target, Target, GameObjectHit.NoHit));

                while (GameStates.NextInWorldStateId != InWorldState.SubState.LiveMode)
                {
                    SpeedTrap.Sleep();
                }

                AnimateSim("NodAsApproval");
                AnimateSim("LeaveMirror");

                /*
                 * (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).NotifySimChanged(Target.ObjectId);
                 */
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }

            return(false);
        }
Ejemplo n.º 4
0
        public override bool Run()
        {
            try
            {
                bool success = false;
                Actor.SynchronizationLevel  = Sim.SyncLevel.NotStarted;
                Target.SynchronizationLevel = Sim.SyncLevel.NotStarted;

                if (BeginSocialInteraction(new SocialInteractionB.Definition(null, Localization.LocalizeString(Actor.IsFemale, "Gameplay/Excel/Socializing/Action:BeAskedToMoveIn", new object[0x0]), false), false, true))
                {
                    BeginCommodityUpdates();
                    mCurrentStateMachine = StateMachineClient.Acquire(Simulator.CurrentTask, "social_AskFor");
                    mCurrentStateMachine.SetActor("x", Actor);
                    mCurrentStateMachine.SetActor("y", Target);
                    mCurrentStateMachine.EnterState("x", "Enter");
                    mCurrentStateMachine.EnterState("y", "Enter");
                    if (AcceptCancelDialog.Show(Localization.LocalizeString("Gameplay/Moving:MoveInPrompt", new object[] { Target, Actor })))
                    {
                        mCurrentStateMachine.RequestState(false, "y", "Friendly");
                        mCurrentStateMachine.RequestState(true, "x", "Friendly");
                        if (!MovingSituation.MovingInProgress)
                        {
                            // Custom
                            using (GameplayMovingModelEx.ProtectFunds protect = new GameplayMovingModelEx.ProtectFunds(Target.Household))
                            {
                                MovingDialogEx.Show(new GameplayMovingModelEx(Target, Actor.Household));
                            }
                        }
                    }
                    else
                    {
                        mCurrentStateMachine.RequestState(false, "y", "Neutral");
                        mCurrentStateMachine.RequestState(true, "x", "Neutral");
                        Actor.SocialComponent.OnMoveInRequestRejected();
                    }

                    if (Actor.Household != Target.Household)
                    {
                        Actor.SocialComponent.OnMoveInRequestRejected();
                    }

                    success = true;
                    EndCommodityUpdates(true);
                }

                Actor.ClearSynchronizationData();
                return(success);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Ejemplo n.º 5
0
        public static void OnFinishMakeoverFreestyle(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i)
        {
            try
            {
                bool tookSemaphore = false;
                Styling.MakeoverOutcome makeoverOutcome = Styling.GetMakeoverOutcome(target, actor, true);
                bool forceFailureOutfit = makeoverOutcome == Styling.MakeoverOutcome.EpicFailure;
                bool flag3 = false;
                try
                {
                    if (forceFailureOutfit)
                    {
                        Styling.LoadMakeoverEpicFailureOutfitForCasOverride(target);
                    }
                    flag3 = GetMakeoverEx.DisplayCAS(target, actor, ref tookSemaphore, forceFailureOutfit);
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    if (tookSemaphore)
                    {
                        GameStates.ReleaseInteractionStateChangeSemaphore();
                    }
                }

                if (CASChangeReporter.Instance.GetPropertyChanged(CASChangeReporter.ChangeFlags.Any))
                {
                    SkillLevel         customerReactionType = Styling.GetCustomerReactionType(target, actor, makeoverOutcome, false);
                    SkillLevel         stylerReactionType   = Styling.GetStylerReactionType(customerReactionType);
                    StateMachineClient client = StateMachineClient.Acquire(actor, "StylistActiveCareer");
                    client.SetActor("x", target);
                    client.SetActor("y", actor);
                    client.SetParameter("doClothesSpin", !flag3);
                    client.SetParameter("customerReactionType", customerReactionType);
                    client.SetParameter("stylistReactionType", stylerReactionType);
                    client.EnterState("x", "Enter");
                    client.EnterState("y", "Enter");
                    actor.LoopIdle();
                    client.RequestState("x", "Customer Reaction");
                    Styling.PostMakeover(target, actor, makeoverOutcome, false, customerReactionType, true, true, new Styling.OnMakeoverCompletedCallback(SocialCallback.OnMakeoverFreestyleCompleted));
                    client.RequestState(false, "x", "Exit");
                    client.RequestState("y", "Stylist Reaction");
                    client.RequestState("y", "Exit");
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
            }
        }
Ejemplo n.º 6
0
        public static StateMachineClient AcquireBreastfeedStateMachine(Sim parent, Sim child)
        {
            StateMachineClient newMachine = StateMachineClient.Acquire(parent, "breastfeed_carry");

            newMachine.SetActor("x", parent);
            newMachine.SetActor("y", child);
            newMachine.EnterState("x", "Enter");
            newMachine.EnterState("y", "Enter");
            return(newMachine);
        }
Ejemplo n.º 7
0
 public void PlayScoldAnims()
 {
     mCurrentStateMachine = StateMachineClient.Acquire(Target, "ChaseMean", AnimationPriority.kAPDefault);
     mCurrentStateMachine.SetActor("x", Target);
     mCurrentStateMachine.SetActor("y", Actor);
     mCurrentStateMachine.EnterState("x", "Enter");
     mCurrentStateMachine.EnterState("y", "Enter");
     AnimateJoinSims("Scold");
     AnimateJoinSims("Exit");
 }
Ejemplo n.º 8
0
            // Methods
            public override bool Run()
            {
                StateMachineClient smc = StateMachineClient.Acquire(base.Actor, "DeathReactions");

                smc.SetActor("x", base.Actor);
                smc.EnterState("x", "Enter");
                base.BeginCommodityUpdates();
                smc.RequestState("x", "Shocked");
                smc.RequestState("x", "LovedOneLoop");
                smc.RequestState("x", "Exit");
                return(true);
            }
Ejemplo n.º 9
0
 private void ShowMeter()
 {
     Animation.CreateTransformController(base.ObjectId);
     this.mSmc = StateMachineClient.Acquire(this.mSim.Proxy.ObjectId, "SkillMeter", AnimationPriority.kAPDefault, false);
     this.mSmc.SetActor("x", this.mSim);
     this.mSmc.SetActor("SkillMeter", this);
     this.mSmc.EnterState("SkillMeter", "Enter");
     this.mSmc.AddOneShotScriptEventHandler(100u, new SacsEventHandler(this.StartGlow));
     this.mSmc.RequestState(false, "SkillMeter", "Open");
     this.UpdateProgress(true);
     this.mPlusPlusAlarm = base.AddAlarmRepeating(this.mProgress.kMinutesPerPlusPlusEffect, TimeUnit.Minutes, new AlarmTimerCallback(this.ShowPlusPlus), this.mProgress.kMinutesPerPlusPlusEffect, TimeUnit.Minutes, "Plus Plus Alarm", AlarmType.AlwaysPersisted);
 }
Ejemplo n.º 10
0
        public void PlayKillingAnimations(string statemachine, string state)
        {
            try
            {
                Player1.CarryStateMachine = StateMachineClient.Acquire(Player1.Proxy.ObjectId, statemachine);
                Player1.CarryStateMachine.SetActor("x", Player1);
                Player1.CarryStateMachine.EnterState("x", state);
            }

            catch (Exception ex)
            {
                Player1.ShowTNSIfSelectable("ex: " + ex, StyledNotification.NotificationStyle.kSystemMessage, ObjectGuid.InvalidObjectGuid, Player1.ObjectId);
            }
        }
Ejemplo n.º 11
0
        public static bool PerformAnimation(Sim actor, OnPerform onPerform)
        {
            IGameObject obj2 = actor.Inventory.SetInUse(typeof(MagicWand), TestFunction, typeof(MagicWand));

            actor.CarryStateMachine = StateMachineClient.Acquire(actor.Proxy.ObjectId, "wand");
            actor.CarryStateMachine.SetActor("x", actor);
            actor.CarryStateMachine.EnterState("x", "Cast Spell - Practice");
            Simulator.Sleep(0x23);
            bool result = onPerform();

            Simulator.Sleep(0x41);
            actor.Inventory.SetNotInUse(obj2);

            return(result);
        }
Ejemplo n.º 12
0
        protected override bool Run()
        {
            StateMachineClient client = StateMachineClient.Acquire(base.Actor, "single_animation");

            client.SetActor("x", base.Actor);
            client.EnterState("x", "Enter");
            Definition interactionDefinition = base.InteractionDefinition as Definition;

            if (Sim.AnimationClipDataForCAS.SimCanPlayAnimation(base.Actor, interactionDefinition.ClipName))
            {
                client.SetParameter("AnimationClip", interactionDefinition.ClipName);
                client.RequestState("x", "Animate");
                client.RequestState(false, "x", "Enter");
            }
            return(true);
        }
Ejemplo n.º 13
0
        public override bool Run()
        {
            this.mClothingPile = this.Actor.GetObjectInRightHand() as ClothingPileWet;
            if (mClothingPile == null)
            {
                ClothingPileWet closestObject1 = GlobalFunctions.GetClosestObject <ClothingPileWet>((IEnumerable <ClothingPileWet>) this.Target.LotCurrent.GetObjects <ClothingPileWet>(), (IGameObject)this.Target);
                if (closestObject1 != null)
                {
                    this.Actor.InteractionQueue.PushAsContinuation(ClothingPileWet.DryClothesInDryer.Singleton, (IGameObject)closestObject1, true);
                    return(true);
                }
                WashingMachine closestObject2 = GlobalFunctions.GetClosestObject <WashingMachine>((IEnumerable <WashingMachine>) this.Target.LotCurrent.GetObjects <WashingMachine>(), (IGameObject)this.Target, new Predicate <WashingMachine>(WashingMachineDoLaundryEx.IsWashingDone));
                if (closestObject2 != null)
                {
                    this.Actor.InteractionQueue.PushAsContinuation(WashingMachine.DryClothesInDryer.Singleton, (IGameObject)closestObject2, true);
                    return(true);
                }
                return(false);
            }
            if (!this.Target.RouteToDryerAndCheckInUse((InteractionInstance)this) || this.Target.CurDryerState != Dryer.DryerState.Empty)
            {
                CarrySystem.PutDownOnFloor(this.Actor, new SacsEventHandler(this.OnPutdownAnimationEvent), 102U);
                return(false);
            }
            this.StandardEntry();
            this.Target.mDryerStateMachine = StateMachineClient.Acquire((IHasScriptProxy)this.Target, "dryer");
            StateMachineClient dryerStateMachine = this.Target.mDryerStateMachine;

            dryerStateMachine.SetActor("x", (IHasScriptProxy)this.Actor);
            dryerStateMachine.SetActor("clothesBag", (IHasScriptProxy)this.mClothingPile);
            dryerStateMachine.SetActor("dryer", (IHasScriptProxy)this.Target);
            dryerStateMachine.EnterState("x", "Enter");
            dryerStateMachine.EnterState("dryer", "Enter");
            dryerStateMachine.AddPersistentScriptEventHandler(0U, new SacsEventHandler(this.OnAnimationEvent));
            this.BeginCommodityUpdates();
            CarrySystem.ExitAndKeepHolding(this.Actor);
            dryerStateMachine.RequestState(false, "dryer", "Start Dryer");
            dryerStateMachine.RequestState(true, "x", "Start Dryer");
            this.EndCommodityUpdates(true);
            dryerStateMachine.RequestState(false, "dryer", "Loop Operate");
            dryerStateMachine.RequestState(true, "x", "Exit Add Clothes");
            Punishment.ApplyAbsolvingActionToSim(this.Actor, Punishment.AbsolvingActionType.DoingLaundry);
            this.StandardExit();
            return(true);
        }
        protected override bool Run()
        {
            StateMachineClient client = StateMachineClient.Acquire(base.Actor, "single_looping_animation");

            client.SetActor("x", base.Actor);
            client.EnterState("x", "EnterExit");
            Definition interactionDefinition = base.InteractionDefinition as Definition;

            if (Sim.AnimationClipDataForCAS.SimCanPlayAnimation(base.Actor, interactionDefinition.ClipName))
            {
                client.SetParameter("AnimationClip", interactionDefinition.ClipName);
                client.RequestState("x", "Animate");
                base.DoLoop(~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                client.RequestState("x", "EnterExit");
                return(true);
            }
            return(false);
        }
Ejemplo n.º 15
0
        public override bool Run()
        {
            List <ObjectListPickerInfo> Entries = ListExpressions();
            string text = (string)ObjectListPickerDialog.Show("Expression", Entries);

            if (text != null && text != "")
            {
                ReactionTypes reaction = (ReactionTypes)Enum.Parse(typeof(ReactionTypes), text);

                Array             reactionTypes = Enum.GetValues(typeof(ReactionTypes));
                CustomOverlayData data          = null;
                CmoPoseBox        box           = PoseManager.FindPoseBox();
                string            poseData      = PoseManager.GetCurrentPose(Actor);
                if (poseData == null)
                {
                    return(false);
                }
                Actor.LookAtManager.DisableLookAts();
                PoseManager.SetCurrentPose(Actor, poseData);
                box.PlaySoloAnimation(Actor.SimDescription.IsHuman, Actor, poseData, true, ProductVersion.BaseGame);
                Actor.ResetAllAnimation();
                Actor.OverlayComponent.UpdateInteractionFreeParts(AwarenessLevel.OverlayFace);//OverlayUpperbody);
                StateMachineClient stateMachineClient = StateMachineClient.Acquire(Actor.ObjectId, "facial_idle", AnimationPriority.kAPDefault, true);
                data = (CustomOverlayData)OverlayComponent.GetOverlayData(reaction, Actor);


                stateMachineClient.UseActorBridgeOrigins = false;
                stateMachineClient.SetActor("x", Actor);
                stateMachineClient.RemoveEventHandler(new SacsEventHandler(Actor.OverlayComponent.InteractionPartLevelCallback));
                stateMachineClient.RemoveEventHandler(new SacsEventHandler(Actor.OverlayComponent.ClearInteractionPartLevelCallback));
                stateMachineClient.EnterState("x", "Enter");
                stateMachineClient.SetProductVersion(data.ProductVersion);
                stateMachineClient.RequestState("x", data.AnimClipName);
                //Actor.OverlayComponent.UpdateInteractionFreeParts(AwarenessLevel.OverlayFace);

                box.PlaySoloAnimation(Actor.SimDescription.IsHuman, Actor, poseData, true, ProductVersion.BaseGame);
                Actor.ResetAllAnimation();

                Actor.WaitForExitReason(3.40282347E+38f, ExitReason.UserCanceled);
                Actor.LookAtManager.EnableLookAts();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 16
0
        public void PlayFaceoffAnims(bool reverseRoles)
        {
            Sim sim  = Actor;
            Sim sim2 = Target;

            if (reverseRoles)
            {
                sim  = Target;
                sim2 = Actor;
            }
            mCurrentStateMachine = StateMachineClient.Acquire(sim, "ChaseMean", AnimationPriority.kAPDefault);
            mCurrentStateMachine.SetActor("x", sim);
            mCurrentStateMachine.SetActor("y", sim2);
            mCurrentStateMachine.EnterState("x", "Enter");
            mCurrentStateMachine.EnterState("y", "Enter");
            BeginCommodityUpdates();
            AnimateJoinSims("Face Off");
            AnimateJoinSims("Exit");
            EndCommodityUpdates(succeeded: true);
        }
Ejemplo n.º 17
0
        protected override bool Run()
        {
            StateMachineClient client = StateMachineClient.Acquire(base.Actor, "single_animation");

            client.SetActor("x", base.Actor);
            client.EnterState("x", "Enter");
            Definition interactionDefinition = base.InteractionDefinition as Definition;

            Sim.AnimationClipDataForCAS[] rcasArray = (interactionDefinition.MenuText == "Full Body Animation Suite") ? Sim.AnimationClipDataForCAS.sCasAnimations["CasFullBodyAnimations"] : Sim.AnimationClipDataForCAS.sCasAnimations["CasFaceAnimations"];
            foreach (Sim.AnimationClipDataForCAS rcas in rcasArray)
            {
                if (Sim.AnimationClipDataForCAS.SimCanPlayAnimation(base.Actor, rcas.AnimationClipName))
                {
                    client.SetParameter("AnimationClip", rcas.AnimationClipName);
                    client.RequestState("x", "Animate");
                    client.RequestState(false, "x", "Enter");
                }
            }
            return(true);
        }
Ejemplo n.º 18
0
        public static StateMachineClient CreateStateMachine(Sim s, HarvestPlant p, out Soil dummyIk)
        {
            dummyIk = Soil.Create(isDummyIk: true);
            StateMachineClient val = StateMachineClient.Acquire(s, "petgardening");

            //dummyIk.SetHiddenFlags(HiddenFlags.Nothing);
            dummyIk.SetPosition(p.GetSoil().Position);
            Vector3 forward = p.GetSoil().Position - s.Position;

            dummyIk.SetForward(forward);
            dummyIk.AddToWorld();
            val.SetActor("x", s);
            val.SetActor("gardenPlantBush", p);
            val.SetActor("gardenSoil", p.GetSoil());
            val.SetActor("Dummy", dummyIk);
            if (!p.PlantDef.GetPlantHeight(out PlantHeight height))
            {
                height = PlantHeight.Medium;
            }
            val.SetParameter("Plant Height", height);
            return(val);
        }
Ejemplo n.º 19
0
        private bool StartCookingProcessWithFoodTray(string menuText, string[] menuPath, Recipe.MealDestination destination, Recipe.MealQuantity quantity, Recipe.MealRepetition repetition)
        {
            List <Ingredient> ingredientsUsed = new List <Ingredient>();

            if (!this.Actor.IsNPC && !AniRecipe.UseUpIngredientsFrom(this.ChosenRecipe, this.Actor, ref ingredientsUsed, quantity, false))
            {
                return(false);
            }
            this.Actor.SkillManager.AddElement(SkillNames.Cooking);
            FoodTray foodTray = (FoodTray)GlobalFunctions.CreateObject("FoodTray", Vector3.OutOfWorld, 0, Vector3.UnitZ);

            foodTray.CookingProcess = new CookingProcess(this.ChosenRecipe, ingredientsUsed, this.Target, this.Target.LotCurrent, destination, quantity, repetition, menuText, menuPath, foodTray, this.Actor);
            foodTray.CreateFoodProp(Slots.Hash("Slot_0"), foodTray.CookingProcess.Recipe.ModelsAndMaterials.GrillModel_FoodTray);
            CookingProcess.MoveToNextStep(foodTray, this.Actor);
            CookingProcess.MoveToNextStep(foodTray, this.Actor);
            CookingProcess.MoveToNextStep(foodTray, this.Actor);
            StateMachineClient stateMachineClient = StateMachineClient.Acquire(this.Actor.Proxy.ObjectId, "Grill");

            if (stateMachineClient == null)
            {
                return(false);
            }
            stateMachineClient.AddInterest <TraitNames>(TraitNames.Clumsy);
            stateMachineClient.SetActor("x", this.Actor);
            stateMachineClient.SetActor("FoodTray", foodTray);
            stateMachineClient.EnterState("x", "Enter - Hands Empty");
            stateMachineClient.RequestState("x", "Take Out Food Tray");
            stateMachineClient.RequestState("x", "Exit - Holding Food Tray");
            if (this.Actor.HasExitReason(ExitReason.Canceled))
            {
                CarrySystem.EnterWhileHolding(this.Actor, foodTray);
                Food.PutHeldObjectDownOnCounterTableOrFloor(this.Actor, SurfaceType.Normal);
                return(false);
            }
            CarrySystem.EnterWhileHolding(this.Actor, foodTray);
            InteractionInstance instance = FoodTray_Prepare.Singleton.CreateInstance(foodTray, this.Actor, this.Actor.InheritedPriority(), base.Autonomous, true);

            return(this.Actor.InteractionQueue.PushAsContinuation(instance, true));
        }
Ejemplo n.º 20
0
        public override bool Run()
        {
            try
            {
                BuffInstance element = Actor.BuffManager.GetElement(BuffNames.ReallyHasToPee);
                if ((element != null) && (element.mTimeoutCount <= UberToilet.kTimeoutRemainingForBladderEmergency))
                {
                    RequestWalkStyle(Sim.WalkStyle.Run);
                }
                else if (!Target.Line.WaitForTurn(this, SimQueue.WaitBehavior.DefaultAllowSubstitution, ~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), UberToilet.kTimeToWaitInLine))
                {
                    return(false);
                }
                else if (!Actor.RouteToSlotAndCheckInUse(Target, Slot.RoutingSlot_0))
                {
                    return(false);
                }

                ClearRequestedWalkStyles();

                // Custom
                if (Shooless.Settings.GetPrivacy(Target))
                {
                    mSituation = Toilet.ToiletSituation.Create(Actor, Actor.LotCurrent);
                }

                if (mSituation != null)
                {
                    if (!mSituation.Start())
                    {
                        return(false);
                    }
                    if (!Actor.RouteToSlotAndCheckInUse(Target, Slot.RoutingSlot_0))
                    {
                        mSituation.ExitToiletSituation();
                        return(false);
                    }
                }

                CancellableByPlayer = false;
                StandardEntry();
                StateMachineClient smc = StateMachineClient.Acquire(Actor, "ubertoilet_store");
                smc.AddInterest <TraitNames>(TraitNames.HotHeaded);
                smc.SetActor("x", Actor);
                smc.SetActor("ubertoilet", Target);
                smc.EnterState("x", "Enter");
                smc.SetParameter("isDirty", Target.Cleanable.NeedsToBeCleaned);
                smc.SetParameter("isBroken", Target.Repairable.Broken);
                mCensorEnabled = true;
                Actor.EnableCensor(Sim.CensorType.LowerBody);
                smc.AddOneShotScriptEventHandler(0x78, TurnOffCensorGrid);
                smc.AddOneShotScriptEventHandler(0xc8, TriggerTrapCallback);
                if (element != null)
                {
                    element.mTimeoutPaused = true;
                }

                bool flag = false;
                if (ShouldSit(Actor))
                {
                    flag = true;
                    Target.PutDownSeat(smc);
                    smc.RequestState("x", "peeSitting");
                    if ((Target.SculptureComponent != null) && (Target.SculptureComponent.Material == SculptureComponent.SculptureMaterial.Ice))
                    {
                        Actor.BuffManager.AddElement(BuffNames.Chilly, Origin.FromSittingOnIce);
                    }
                    if (Target.ToiletTuning.AutoFlushes && RandomUtil.RandomChance((float)UberToilet.kChanceOfToiletAutoFlushWhileInUse))
                    {
                        smc.RequestState("x", "flushReaction");
                    }
                }
                else
                {
                    Target.PutUpSeat(smc);
                    smc.RequestState("x", "peeStanding");
                }

                if (!Target.Repairable.Broken && (Target.mToiletOnStatus == UberToilet.ToiletOnStatus.Auto))
                {
                    Target.StartMusic();
                }

                BeginCommodityUpdate(CommodityKind.Bladder, 0f);
                BeginCommodityUpdates();
                Actor.Motives.LerpToFill(this, CommodityKind.Bladder, UberToilet.kMaxLengthUseToilet);
                StartStages();
                OccultImaginaryFriend.GrantMilestoneBuff(Actor, BuffNames.ImaginaryFriendFeelOfPorcelain, Origin.FromImaginaryFriendFirstTime, true, true, false);
                bool succeeded = DoLoop(~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.BuffFailureState | ExitReason.MaxSkillPointsReached | ExitReason.HigherPriorityNext));
                Actor.BuffManager.UnpauseBuff(BuffNames.ImaginaryFriendFeelOfPorcelain);
                EndCommodityUpdates(succeeded);
                if (succeeded)
                {
                    Actor.Motives.GetMotive(CommodityKind.Bladder).PotionBladderDecayOverride = false;
                }

                if (element != null)
                {
                    element.mTimeoutPaused = false;
                }

                Target.Cleanable.DirtyInc(Actor);
                if (Target.ShouldPutDownSeat(Actor))
                {
                    Target.PutDownSeat(smc);
                }

                InteractionInstance instance = null;
                bool flag3 = Target.Line.MemberCount() > 0x1;
                if (Target.Repairable.Broken)
                {
                    if (flag)
                    {
                        smc.RequestState("x", "electricBreakSitting");
                    }
                    else
                    {
                        smc.RequestState("x", "electricBreakStanding");
                    }
                }

                if ((mSituation == null) || !mSituation.SomeoneDidIntrude)
                {
                    if (!Target.ToiletTuning.AutoFlushes)
                    {
                        Target.ToiletVolume++;
                        if (Target.ShouldFlush(Actor, Autonomous))
                        {
                            Target.FlushToilet(Actor, smc, true);
                        }
                    }

                    if (Target.ShouldWashHands(Actor) && !flag3)
                    {
                        Sink target = Toilet.FindClosestSink(Actor);
                        if (target != null)
                        {
                            instance = Sink.WashHands.Singleton.CreateInstance(target, Actor, GetPriority(), false, true);
                        }
                    }
                }

                if (Target.mToiletOnStatus == UberToilet.ToiletOnStatus.Auto)
                {
                    Target.StopMusic();
                }

                if (!Target.Repairable.Broken)
                {
                    if (Target.Upgradable.SelfCleaning && Target.mSelfCleanOn)
                    {
                        smc.RequestState("x", "autoClean");
                        Target.Cleanable.ForceClean();
                        Actor.BuffManager.AddElement(BuffNames.Relaxed, Origin.None);
                        Actor.Motives.ChangeValue(CommodityKind.Hygiene, UberToilet.kChanceOfRelaxed);
                    }
                    else if (RandomUtil.RandomChance(UberToilet.kChanceOfRelaxed))
                    {
                        Actor.BuffManager.AddElement(BuffNames.Relaxed, Origin.None);
                    }
                }

                smc.RequestState("x", "Exit");
                if (mSituation != null)
                {
                    mSituation.ExitToiletSituation();
                }

                if (flag3)
                {
                    PrivacySituation.RouteToAdjacentRoom(Actor);
                }

                StandardExit();
                if (instance != null)
                {
                    Actor.InteractionQueue.PushAsContinuation(instance, false);
                }
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Ejemplo n.º 21
0
 public void AcquirePregnancyStateMachine()
 {
     mCurrentStateMachine = StateMachineClient.Acquire(Actor, "Pregnancy");
 }
Ejemplo n.º 22
0
        public override bool OnPortalStart(Sim sim)
        {
            try
            {
                if ((mCurrentlyRoutingSim != null) && (mCurrentlyRoutingSim.HasBeenDestroyed))
                {
                    if (mSMC != null)
                    {
                        mSMC.Dispose();
                        mSMC = null;
                    }
                }

                mCurrentlyRoutingSim = sim;

                if (mSMC != null)
                {
                    sim.PlayRouteFailure(mPortal);
                    return(false);
                }

                AncientPortal targetPortal = null;
                if (!sTargetPortals.TryGetValue(sim, out targetPortal))
                {
                    sim.PlayRouteFailure(mPortal);
                    return(false);
                }

                if (targetPortal == mPortal)
                {
                    return(false);
                }

                mPortal.AddToUseList(sim);

                sim.SimRoutingComponent.OnRouteActionsFinished -= OnPortalApproachCancelledAndFinished;
                sim.SetExitReasonsInterruptForMultiPortalRoute();
                sim.SimRoutingComponent.StartIgnoringObstacles();

                targetPortal.AddToUseList(sim);

                targetPortal.EnableFootprint(AncientPortal.CatchABeam.FootprintPlacementHash);
                targetPortal.PushSimsFromFootprint(AncientPortal.CatchABeam.FootprintPlacementHash, sim, null, false);

                Vector3 slotFoward = mPortal.GetForwardOfSlot(mPortal.GetRoutingSlots()[0]);

                sim.SetForward(slotFoward);

                mSMC = StateMachineClient.Acquire(sim, "AncientPortal", AnimationPriority.kAPDefault);
                mSMC.SetActor("x", sim);
                mSMC.SetActor("portal", mPortal);
                mSMC.EnterState("x", "Enter");
                mSMC.EnterState("portal", "Enter");

                mSMC.AddOneShotScriptEventHandler(0x65, HideSim);
                mSMC.AddOneShotScriptEventHandler(0x66, ShowSim);

                mSMC.RequestState("x", "InsidePortal");

                mPortal.RemoveFromUseList(sim);

                return(true);
            }
            catch (ResetException)
            {
                if (mCurrentlyRoutingSim != null)
                {
                    mCurrentlyRoutingSim.SetHiddenFlags(HiddenFlags.Nothing);
                }

                throw;
            }
            catch (Exception e)
            {
                if (mCurrentlyRoutingSim != null)
                {
                    mCurrentlyRoutingSim.SetHiddenFlags(HiddenFlags.Nothing);
                }

                Common.Exception(sim, Owner, e);
                return(false);
            }
        }
Ejemplo n.º 23
0
        public override bool Run()
        {
            try
            {
                Sim linkedActor = GetSelectedObject() as Sim;
                if (linkedActor == Actor)
                {
                    linkedActor = null;
                }

                if (linkedActor != null)
                {
                    HotAirBalloonSit entry = Singleton.CreateInstance(Target, linkedActor, GetPriority(), Autonomous, CancellableByPlayer) as HotAirBalloonSit;
                    entry.LinkedInteractionInstance = this;
                    linkedActor.InteractionQueue.Add(entry);
                }

                HotAirBalloonSit linked = LinkedInteractionInstance as HotAirBalloonSit;
                if (linked != null)
                {
                    linkedActor = linked.Actor;
                }

                bool isXActor = Target.mLeftActorId == 0x0L;
                if (!isXActor && (Target.mRightActorId != 0x0L))
                {
                    return(false);
                }

                if (isXActor)
                {
                    Target.mLeftActorId = Actor.SimDescription.SimDescriptionId;
                }
                else
                {
                    Target.mRightActorId = Actor.SimDescription.SimDescriptionId;
                }

                Route r = Actor.CreateRoute();

                if (linkedActor != null)
                {
                    r.AddObjectToIgnoreForRoute(linkedActor.ObjectId);
                }

                if (!r.PlanToSlot(Target, Slot.RoutingSlot_7).Succeeded())
                {
                    if (isXActor)
                    {
                        Target.mLeftActorId = 0x0L;
                    }
                    else
                    {
                        Target.mRightActorId = 0x0L;
                    }
                    return(false);
                }

                if ((Target.mTargetHeight != HotairBalloon.BalloonHeight.OnGround) || (Target.mCurrentHeight != HotairBalloon.BalloonHeight.OnGround))
                {
                    Actor.PlayRouteFailure();

                    if (isXActor)
                    {
                        Target.mLeftActorId = 0x0L;
                    }
                    else
                    {
                        Target.mRightActorId = 0x0L;
                    }
                    return(false);
                }

                r = Actor.CreateRoute();
                if (linkedActor != null)
                {
                    r.AddObjectToIgnoreForRoute(linkedActor.ObjectId);
                }

                r.AddObjectToIgnoreForRoute(Target.ObjectId);
                if (!r.PlanToSlot(Target, isXActor ? Slot.RoutingSlot_5 : Slot.RoutingSlot_2).Succeeded())
                {
                    Target.ResetParentingHierarchy(true);
                    r.PlanToSlot(Target, isXActor ? Slot.RoutingSlot_5 : Slot.RoutingSlot_2);
                }

                if (!Actor.DoRoute(r))
                {
                    if (isXActor)
                    {
                        Target.mLeftActorId = 0x0L;
                    }
                    else
                    {
                        Target.mRightActorId = 0x0L;
                    }
                    return(false);
                }

                StandardEntry();
                BeginCommodityUpdates();
                Animation.ForceAnimation(Actor.ObjectId, true);
                if (Target.mFlyStateMachine == null)
                {
                    Target.mFlyStateMachine = StateMachineClient.Acquire(Target, "hotairballoon_store", AnimationPriority.kAPDefault);
                    Target.mFlyStateMachine.SetActor("hotairBalloonX", Target);
                    Target.mFlyStateMachine.EnterState("hotairBalloonX", "BalloonLiftOff");
                }

                AcquireStateMachine("hotairballoon_store");
                mCurrentStateMachine.SetActor("x", Actor);
                mCurrentStateMachine.SetActor("hotairBalloonX", Target);
                mCurrentStateMachine.SetParameter("XSimR", isXActor ? YesOrNo.no : YesOrNo.yes);
                mCurrentStateMachine.EnterState("x", "EnterBalloon");
                Slot  slotName = isXActor ? ((Slot)(0xa820f8a5)) : ((Slot)(0xa820f8a2));
                float f        = (float)Math.Acos((double)(Target.ForwardVector * Actor.ForwardVector));
                if (float.IsNaN(f))
                {
                    f = 3.141593f;
                }

                Actor.ParentToSlot(Target, slotName, f, false);
                mCurrentStateMachine.RequestState("x", "IdleStand");
                EndCommodityUpdates(true);

                HotairBalloon.InBalloonPosture posture = new HotairBalloon.InBalloonPosture(Actor, Target, isXActor, mCurrentStateMachine);
                Actor.Posture = posture;

                if ((Autonomous) && (RandomUtil.RandomChance(HotairBalloon.kChanceToCallOverRomanticInterest)))
                {
                    Sim actor = Target.FindRomanticSimToRideWith(Actor);
                    if ((actor != null) && !actor.InteractionQueue.HasInteractionOfType(Singleton))
                    {
                        InteractionInstance entry = Singleton.CreateInstance(Target, actor, new InteractionPriority(InteractionPriorityLevel.Autonomous), true, true);
                        actor.InteractionQueue.Add(entry);
                        mCurrentStateMachine.RequestState("x", "CallOver");
                        mCurrentStateMachine.RequestState("x", "IdleStand");
                        mCurrentStateMachine.RequestState("x", "CallOver");
                        mCurrentStateMachine.RequestState("x", "IdleStand");
                    }
                }

                StandardExit();
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Ejemplo n.º 24
0
        // Token: 0x06009AEB RID: 39659 RVA: 0x00350290 File Offset: 0x0034E490
        public override bool Run()
        {
            try
            {
                /*
                 * this.mSituation = (ServiceSituation.FindServiceSituationInvolving(this.Actor) as GrimReaperSituation);
                 * //this.mSituation.AddRelationshipWithEverySimInHousehold();
                 * this.Actor.SetPosition(this.mSituation.Lot.Position);
                 * this.mSituation.ScaredReactionBroadcaster = new ReactionBroadcaster(this.Actor, GrimReaperSituation.ScaredParams, new ReactionBroadcaster.BroadcastCallback(GrimReaperSituation.ScaredDelegate));
                 * try
                 * {
                 *  Sim sim = Target;
                 *  if (sim != null)
                 *  {
                 *      Matrix44 transform = sim.Transform;
                 *      Matrix44 invalid = Matrix44.Invalid;
                 *      Vector3 position = Actor.Position;
                 *      float num = (this.Actor.Position - sim.Position).LengthSqr();
                 *      if (num < 0.25f || num > 4f)
                 *      {
                 *          double @double = RandomUtil.GetDouble(6.2831853071795862);
                 *          position = sim.Position + new Vector3((float)Math.Sin(@double), 0f, (float)Math.Cos(@double));
                 *      }
                 *      this.Actor.SetForward(sim.PositionOnFloor - this.Actor.PositionOnFloor);
                 *      this.Actor.SetForward(new Vector3(this.Actor.ForwardVector.x, 0f, this.Actor.ForwardVector.z));
                 *      SimDescription.DeathType deathStyle = sim.SimDescription.DeathStyle;
                 *  }
                 * }
                 * catch (Exception exception)
                 * {
                 *  NiecException.PrintMessage("1a" + exception.Message + NiecException.NewLine + exception.StackTrace);
                 * }
                 *
                 * this.Actor.GreetSimOnLot(this.mSituation.Worker.LotCurrent);
                 * try
                 * {
                 *  this.mSituation.SMCDeath = StateMachineClient.Acquire(this.Actor, "Death");
                 *  this.mSituation.SMCDeath.SetActor("x", this.Actor);
                 *  this.mSituation.SMCDeath.EnterState("x", "Enter");
                 *  this.mSituation.SMCDeath.AddOneShotScriptEventHandler(666u, new SacsEventHandler(this.EventCallbackFadeInReaper));
                 *  this.mSituation.StartGrimReaperSmoke();
                 *  this.mSituation.SMCDeath.RequestState("x", "Float");
                 *  this.Actor.Posture = new SimCarryingObjectPosture(this.Actor, null);
                 *  this.mWasMemberOfActiveHousehold = (this.Target.Household == Household.ActiveHousehold);
                 *  if (this.Target.DeathReactionBroadcast == null)
                 *  {
                 *      Urnstone.CreateDeathReactionBroadcaster(this.Target);
                 *  }
                 * }
                 * catch (Exception exception)
                 * {
                 *  NiecException.PrintMessage("2" + exception.Message + NiecException.NewLine + exception.StackTrace);
                 * }
                 * try
                 * {
                 *  this.Actor.SynchronizationLevel = Sim.SyncLevel.NotStarted;
                 *  this.Target.SynchronizationLevel = Sim.SyncLevel.NotStarted;
                 *  this.mDeadSimsHousehold = this.Target.Household;
                 *  this.mSMCDeath = this.mSituation.SMCDeath;
                 *  ThoughtBalloonManager.BalloonData balloonData = new ThoughtBalloonManager.DoubleBalloonData("moodlet_mourning", this.Target.GetThoughtBalloonThumbnailKey());
                 *  balloonData.BalloonType = ThoughtBalloonTypes.kSpeechBalloon;
                 *  balloonData.mPriority = ThoughtBalloonPriority.High;
                 *  this.Actor.ThoughtBalloonManager.ShowBalloon(balloonData);
                 * }
                 * catch (Exception exception)
                 * {
                 *  NiecException.PrintMessage("3" + exception.Message + NiecException.NewLine + exception.StackTrace);
                 * }
                 * try
                 * {
                 *  var killSim = this.Target.CurrentInteraction as ExtKillSimNiec;
                 *  if (killSim != null)
                 *  {
                 *      killSim.StartDeathEffect();
                 *  }
                 *  Audio.StartSound("sting_death", this.Actor.Position);
                 *  this.mSMCDeath.RequestState("x", "take_sim");
                 *  this.mSMCDeath.RequestState("x", "Exit");
                 *  this.Target.FadeOut();
                 *  this.FinalizeDeath();
                 *  this.GrimReaperPostSequenceCleanup();
                 *  this.Target.StartOneShotFunction(new Sims3.Gameplay.Function(this.ReapSoulCallback), GameObject.OneShotFunctionDisposeFlag.OnDispose);
                 * }
                 * catch (Exception exception)
                 * {
                 *  NiecException.PrintMessage("4" + exception.Message + NiecException.NewLine + exception.StackTrace);
                 * }
                 * return true;
                 */
                //var grimReaperSituation = ServiceSituation.FindServiceSituationInvolving as ;
                //grimReaperSituation.AddRelationshipWithEverySimInHousehold();

                //grimReaperSituation.ScaredReactionBroadcaster = new ReactionBroadcaster(this.Actor, GrimReaperSituation.ScaredParams, new ReactionBroadcaster.BroadcastCallback(GrimReaperSituation.ScaredDelegate));

                this.Actor.SetPosition(Actor.Position);

                SimDescription.DeathType deathType = SimDescription.DeathType.Drown;

                try
                {
                    Sim sim = FindClosestDeadSim();
                    if (sim != null)
                    {
                        Vector3 position = Vector3.Invalid;
                        World.FindGoodLocationParams fglParams = new World.FindGoodLocationParams(sim.Position);
                        Vector3 vector;
                        if (!GlobalFunctions.FindGoodLocation(this.Actor, fglParams, out position, out vector))
                        {
                            position = fglParams.StartPosition;
                        }
                        this.Actor.SetPosition(position);
                        this.Actor.RouteTurnToFace(sim.Position);
                        deathType = sim.SimDescription.DeathStyle;
                    }
                }
                catch (Exception exception)
                {
                    NiecException.PrintMessage("SAE" + exception.Message + NiecException.NewLine + exception.StackTrace);
                }

                //this.Actor.GreetSimOnLot(grimReaperSituation.Worker.LotCurrent);
                SMCDeath = StateMachineClient.Acquire(this.Actor, "DeathSequence");
                SMCDeath.SetActor("x", this.Actor);
                SMCDeath.EnterState("x", "Enter");
                Urnstone.FogEffectTurnAllOn(Actor.LotCurrent);
                VisualEffect visualEffect = Urnstone.ReaperApperEffect(this.Actor, deathType);
                visualEffect.Start();
                //grimReaperSituation.StartGrimReaperSmoke();
                VisualEffect.FireOneShotEffect("reaperSmokeConstant", Actor, Sim.FXJoints.Pelvis, VisualEffect.TransitionType.HardTransition);

                SMCDeath.AddOneShotScriptEventHandler(666u, new SacsEventHandler(this.EventCallbackFadeInReaper));
                SMCDeath.RequestState("x", "ReaperBrushingHimself");
                visualEffect.Stop();
                ReaperLoop = new ObjectSound(this.Actor.ObjectId, "death_reaper_lp");
                ReaperLoop.Start(true);
                this.Actor.Posture = new SimCarryingObjectPosture(this.Actor, null);
                return(true);
            }
            catch (Exception exception)
            {
                NiecException.PrintMessage("ASF" + exception.Message + NiecException.NewLine + exception.StackTrace);
                return(true);
            }
        }
Ejemplo n.º 25
0
        public override bool Run()
        {
            try
            {
                if (WoohooHouse == null)
                {
                    return(false);
                }
                if (!SafeToSync())
                {
                    return(false);
                }
                PetHouse.WoohooPetHouseB entry = PetHouse.WoohooPetHouseB.Singleton.CreateInstance(Actor, Target, GetPriority(), Autonomous, CancellableByPlayer) as PetHouse.WoohooPetHouseB;
                entry.LinkedInteractionInstance = this;
                Target.InteractionQueue.Add(entry);
                Actor.SynchronizationLevel  = Sim.SyncLevel.Started;
                Actor.SynchronizationTarget = Target;
                Actor.SynchronizationRole   = Sim.SyncRole.Initiator;
                if (!WoohooHouse.SimLine.WaitForTurn(this, SimQueue.WaitBehavior.Default, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), 10f))
                {
                    return(false);
                }
                if (!Actor.RouteToSlotAndCheckInUse(WoohooHouse, Slot.RoutingSlot_3))
                {
                    if (!Actor.HasExitReason(ExitReason.RouteFailed))
                    {
                        WoohooHouse.SimLine.RemoveFromQueue(Actor);
                        WoohooHouse.PlayRouteFailAndWanderAway(Actor);
                        return(false);
                    }
                    Actor.RemoveExitReason(ExitReason.RouteFailed);
                    if (!Actor.RouteToSlotAndCheckInUse(WoohooHouse, Slot.RoutingSlot_3))
                    {
                        WoohooHouse.SimLine.RemoveFromQueue(Actor);
                        WoohooHouse.PlayRouteFailAndWanderAway(Actor);
                        return(false);
                    }
                }
                StandardEntry();
                WoohooHouse.AddToUseList(Actor);
                WoohooHouse.AddToUseList(Target);
                EnterStateMachine("PetHouse", "enter", "x");
                SetActor("petHouse", WoohooHouse);
                SetActor("y", Target);
                Animate("x", "getInWoohooX");
                Actor.ParentToSlot(WoohooHouse, WoohooHouse.GetContainmentSlotForActor(Actor));
                WoohooHouse.SimLine.RemoveFromQueue(Actor);
                if (!Actor.WaitForSynchronizationLevelWithSim(Target, Sim.SyncLevel.Routed, 30f))
                {
                    Actor.UnParent();
                    Animate("x", "inHouseNeutral");
                    Animate("x", "exit");
                    StandardExit();
                    WoohooHouse.RemoveFromUseList(Actor);
                    WoohooHouse.RemoveFromUseList(Target);
                    return(false);
                }
                BeginCommodityUpdates();
                (LinkedInteractionInstance as PetHouse.WoohooPetHouseB).BeginCommodityUpdates();
                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                EnterState("y", "enter");
                Animate("y", "getInWoohooY");
                AnimateJoinSims("woohoo");
                Actor.UnParent();
                AnimateSim("exitWoohoo");
                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);

                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                CommonWoohoo.RunPostWoohoo(Actor, Target, WoohooHouse, definition.GetStyle(this), definition.GetLocation(WoohooHouse), true);

                if (CommonPregnancy.IsSuccess(Actor, Target, Autonomous, definition.GetStyle(this)))
                {
                    CommonPregnancy.Impregnate(Actor, Target, Autonomous, definition.GetStyle(this));
                }

                StateMachineClient smc = StateMachineClient.Acquire(Actor, "PetHouse");
                smc.SetActor("petHouse", WoohooHouse);
                smc.SetActor("x", Actor);
                smc.EnterState("x", "inHouseNeutral");
                PetHouse.PetHousePosture posture = new PetHouse.PetHousePosture(WoohooHouse, Actor, smc);
                Actor.Posture       = posture;
                ActorStayingInHouse = Actor.InteractionQueue.PushAsContinuation(PetHouse.LieDown.Singleton.CreateInstance(WoohooHouse, Actor, GetPriority(), Autonomous, CancellableByPlayer), true);
                if (!ActorStayingInHouse)
                {
                    posture.CancelPosture(Actor);
                }
                EndCommodityUpdates(true);
                (LinkedInteractionInstance as PetHouse.WoohooPetHouseB).EndCommodityUpdates(true);
                PlumbBob.Reparent();
                StandardExit();
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
                return(false);
            }
        }
Ejemplo n.º 26
0
        public bool BaseRunEx()
        {
            mRelationship = Relationship.Get(Actor, Target, true);
            if (mRelationship == null)
            {
                return(false);
            }
            bool flag = false;

            if (IsSlowDance)
            {
                string reason;
                GreyedOutTooltipCallback greyedOutTooltipCallback = null;
                if (CommonSocials.CanGetRomantic(Actor, Target, false, false, true, ref greyedOutTooltipCallback, out reason))
                {
                    flag = true;
                }
            }
            else
            {
                foreach (CommodityTypes types in kAcceptableCommodities)
                {
                    if (mRelationship.STC.CurrentCommodity == types)
                    {
                        flag = true;
                        break;
                    }
                }
            }

            Definition interactionDefinition = InteractionDefinition as Definition;
            IDanceable danceObject           = interactionDefinition.DanceObject;

            if (flag)
            {
                mDanceFloor = DanceFloor.FindAndRouteOntoADanceFloorWithFollower(Actor, Target, danceObject);
                if (mDanceFloor != null)
                {
                    mDanceFloor.AddToUseList(Actor);
                    if (!mDanceFloor.IsActorUsingMe(Target))
                    {
                        mDanceFloor.AddToUseList(Target);
                    }
                }
            }

            Stereo targetStereo = interactionDefinition.TargetStereo;

            if (targetStereo != null)
            {
                targetStereo.AddSimListener(Actor);
                targetStereo.AddSimListener(Target);
            }

            string         instanceName = "SocialJigTwoPerson";
            ProductVersion baseGame     = ProductVersion.BaseGame;

            if (IsSlowDance)
            {
                instanceName = "SlowdanceJig";
                baseGame     = ProductVersion.EP8;
            }

            SocialJig = GlobalFunctions.CreateObjectOutOfWorld(instanceName, baseGame) as SocialJigTwoPerson;
            bool succeeded = false;

            Actor.SynchronizationLevel  = Sim.SyncLevel.NotStarted;
            Target.SynchronizationLevel = Sim.SyncLevel.NotStarted;
            string name = (Stereo.PartySimIsGettingMusicFromPartyLocation(Actor, danceObject) || Stereo.PartySimIsGettingMusicFromPartyLocation(Target, danceObject)) ? LocalizeString("BeRockingDancingTogether", new object[0x0]) : LocalizeString("BeDancingTogether", new object[0x0]);

            if (BeginSocialInteraction(new SocialInteractionB.Definition(null, name, false), true, false))
            {
                IGlass objectInRightHand = Actor.GetObjectInRightHand() as IGlass;
                if (objectInRightHand != null)
                {
                    objectInRightHand.PutGlassAway();
                }
                objectInRightHand = Target.GetObjectInRightHand() as IGlass;
                if (objectInRightHand != null)
                {
                    objectInRightHand.PutGlassAway();
                }

                string             stateMachineName = IsSlowDance ? "slowdance_together" : "dance_together";
                StateMachineClient smc = StateMachineClient.Acquire(Actor, stateMachineName);
                if (IsSlowDance)
                {
                    smc.SetActor("x", Actor);
                    smc.SetActor("y", Target);
                }
                else
                {
                    smc.SetActor("x", Target);
                    smc.SetActor("y", Actor);
                }
                smc.EnterState("x", "enter");
                smc.EnterState("y", "enter");
                if (GameUtils.IsInstalled(ProductVersion.EP7))
                {
                    smc.SetParameter("xIsProper", Target.HasTrait(TraitNames.Proper));
                    smc.SetParameter("yIsProper", Actor.HasTrait(TraitNames.Proper));
                }
                BeginCommodityUpdates();
                smc.RequestState(false, "x", "Ask_To_Dance");
                smc.RequestState(true, "y", "Ask_To_Dance");
                if (flag)
                {
                    smc.RequestState(false, "x", "Last_Sync");
                    smc.RequestState(true, "y", "Last_Sync");
                    smc.RequestState(false, "x", "dance");
                    smc.RequestState(true, "y", "dance");
                    Actor.SkillManager.StartGainAndAddSkillIfNeeded(SkillNames.Dancing, Stereo.kRateOfSkillGainForDancing);
                    Target.SkillManager.StartGainAndAddSkillIfNeeded(SkillNames.Dancing, Stereo.kRateOfSkillGainForDancing);
                    if (IsSlowDance)
                    {
                        EventTracker.SendEvent(EventTypeId.kSlowDanced, Actor, Target);
                        EventTracker.SendEvent(EventTypeId.kSlowDanced, Target, Actor);
                    }
                    succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(DanceTogetherDelegate), smc);
                    Actor.SkillManager.StopSkillGain(SkillNames.Dancing);
                    Target.SkillManager.StopSkillGain(SkillNames.Dancing);
                    smc.RequestState(false, "x", "friendly");
                    smc.RequestState(true, "y", "friendly");
                }
                else
                {
                    smc.RequestState(false, "x", "awkward");
                    smc.RequestState(true, "y", "awkward");
                    mRelationship.LTR.UpdateLiking(Stereo.kLtrDecreaseAfterRejectingDanceTogether);
                    succeeded = false;
                }
            }

            Definition definition2 = InteractionDefinition as Definition;

            if ((definition2 != null) && (definition2.DanceObject is DJTurntable))
            {
                EventTracker.SendEvent(EventTypeId.kDanceToDJMusic, Target);
                EventTracker.SendEvent(EventTypeId.kDanceToDJMusic, Actor);
            }

            EndCommodityUpdates(succeeded);
            Actor.ClearSynchronizationData();
            return(succeeded);
        }
Ejemplo n.º 27
0
        public override bool Run()
        {
            bool result;

            try
            {
                if (Actor.LotCurrent != Target)
                {
                    Vector3 point = World.LotGetPtInside(Target.LotId);

                    if (point == Vector3.Invalid)
                    {
                        return(false);
                    }

                    if (!Actor.RouteToPointRadius(point, 3f) &&
                        (!GlobalFunctions.PlaceAtGoodLocation(Actor, new World.FindGoodLocationParams(point), false) ||
                         !SimEx.IsPointInLotSafelyRoutable(Actor, Target, Actor.Position)))
                    {
                        Actor.AttemptToPutInSafeLocation(true);
                    }
                }

                if (Actor.Posture is SwimmingInPool && !(Actor.Posture as SwimmingInPool).ContainerPool.RouteToEdge(Actor))
                {
                    if (Actor.BridgeOrigin != null)
                    {
                        Actor.BridgeOrigin.MakeRequest();
                    }

                    Actor.PopPosture();
                    IGameObject reservedTile = null;
                    Actor.FindRoutablePointInsideNearFrontDoor(Actor.Household.LotHome, out reservedTile);
                    Vector3 position            = reservedTile.Position;
                    Terrain.TeleportMeHere here = Terrain.TeleportMeHere.Singleton.CreateInstance(Terrain.Singleton, Actor,
                                                                                                  new InteractionPriority(InteractionPriorityLevel.Pregnancy), false, false) as Terrain.TeleportMeHere;
                    here.SetAndReserveDestination(reservedTile);

                    try
                    {
                        here.RunInteractionWithoutCleanup();
                    }
                    catch
                    {
                        Actor.SetPosition(position);
                    }
                    finally
                    {
                        here.Cleanup();
                    }

                    Actor.LoopIdle();
                }

                AlienPregnancyProxy pregnancy = new AlienPregnancyProxy(Actor.SimDescription.Pregnancy);
                Sims3.Gameplay.Gameflow.Singleton.DisableSave(this, "Gameplay/ActorSystems/Pregnancy:DisableSave");
                mNewborns            = pregnancy.CreateNewborns(0f, Actor.IsSelectable, true);
                mCurrentStateMachine = StateMachineClient.Acquire(Actor, "Pregnancy");
                mCurrentStateMachine.SetActor("x", Actor);

                for (int i = 0; i < mNewborns.Count; i++)
                {
                    Sim baby = mNewborns[i];
                    Relationship.Get(Actor, baby, true).LTR.ForceChangeState(LongTermRelationshipTypes.Friend);

                    if (baby.BridgeOrigin != null)
                    {
                        baby.BridgeOrigin.MakeRequest();
                        baby.BridgeOrigin = null;
                    }

                    HaveAlienBabyHomeInternal instance = HaveAlienBabyHomeInternal.Singleton.CreateInstance(baby, Actor, GetPriority(),
                                                                                                            Autonomous, CancellableByPlayer) as HaveAlienBabyHomeInternal;
                    instance.TotalCount           = mNewborns.Count;
                    instance.BabyIndex            = i + 1;
                    instance.mCurrentStateMachine = mCurrentStateMachine;
                    Actor.InteractionQueue.PushAsContinuation(instance, true);
                }

                if (Actor.IsSelectable)
                {
                    OccultImaginaryFriend.DeliverDollToHousehold(mNewborns);
                }

                result = true;
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);

                result = false;
            }

            return(result);
        }
Ejemplo n.º 28
0
        // Token: 0x06006FAE RID: 28590 RVA: 0x0026BB9C File Offset: 0x0026AB9C
        //[DoesntRequireTuning]
        public override bool Run()
        {
            try
            {
                try
                {
                    if (!this.CreateGraveStone())
                    {
                        return(false);
                    }
                }
                catch (Exception exception)
                {
                    NiecException.PrintMessage("CreateGraveStone " + exception.Message + NiecException.NewLine + exception.StackTrace);
                }

                try
                {
                    SMCDeath = StateMachineClient.Acquire(this.Actor, "DeathSequence");

                    this.mSMCDeath = SMCDeath;
                    this.mSMCDeath.SetActor("y", this.Target);
                    this.mSMCDeath.SetActor("grave", this.mGrave);
                    this.mSMCDeath.EnterState("y", "Enter");
                }
                catch (Exception exception)
                {
                    NiecException.PrintMessage("SMCDeath " + exception.Message + NiecException.NewLine + exception.StackTrace);
                }

                if (this.Target.SimDescription.DeathStyle == SimDescription.DeathType.Drown)
                {
                    if (!this.RouteGrimReaperToEdgeOfTargetPool())
                    {
                        this.Actor.RouteTurnToFace(this.Target.Position);
                    }
                }
                else if (!this.mSituation.mIsFirstSim)
                {
                    Route route = this.Actor.CreateRoute();
                    route.PlanToPointRadialRange(this.Target.Position, 1f, 5f, RouteDistancePreference.PreferNearestToRouteDestination, RouteOrientationPreference.TowardsObject, this.Target.LotCurrent.LotId, null);
                    this.Actor.DoRoute(route);
                }
                else
                {
                    this.mSituation.mIsFirstSim = false;
                }
                this.PlaceGraveStone();
                this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.GravePlaced;
                this.Actor.RouteTurnToFace(this.Target.Position);
                PetStartleBehavior.CheckForStartle(this.Actor, StartleType.GrimReaperAppear);
                if (!this.mSituation.mIsFirstSim)
                {
                    this.mSMCDeath.EnterState("x", "Enter");
                }
                this.mSMCDeath.RequestState(true, "x", "CreateTombstone");
                ThoughtBalloonManager.BalloonData balloonData = new ThoughtBalloonManager.DoubleBalloonData("balloon_moodlet_mourning", this.Target.GetThoughtBalloonThumbnailKey());
                balloonData.BalloonType = ThoughtBalloonTypes.kSpeechBalloon;
                balloonData.mPriority   = ThoughtBalloonPriority.High;
                this.Actor.ThoughtBalloonManager.ShowBalloon(balloonData);
                this.mSMCDeath.RequestState(true, "x", "ReaperPointAtGrave");
                this.mSMCDeath.RequestState(false, "x", "ReaperFloating");
                this.mGhostPosition = this.GetPositionForGhost(this.Target, this.mGrave);
                Lot lotCurrent = this.Target.LotCurrent;
                if (lotCurrent != this.Target.LotHome && lotCurrent.Household != null)
                {
                    this.Target.GreetSimOnLot(lotCurrent);
                }
                base.RequestWalkStyle(this.Target, Sim.WalkStyle.GhostWalk);
                switch (this.Target.SimDescription.DeathStyle)
                {
                case SimDescription.DeathType.Drown:
                    if (this.Target.BridgeOrigin != null)
                    {
                        this.Target.BridgeOrigin.MakeRequest();
                    }
                    this.Target.PopPosture();
                    this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackSimToGhostEffectNoFadeOut));
                    this.mSMCDeath.AddOneShotScriptEventHandler(102u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose));
                    this.mSMCDeath.RequestState(true, "y", "PoseStarvation");
                    this.mSMCDeath.RequestState(true, "y", "StarvationToFloat");
                    this.mSMCDeath.RequestState(false, "y", "GhostFloating");
                    break;

                case SimDescription.DeathType.Starve:
                    this.StartGhostExplosion();
                    this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose));
                    this.mSMCDeath.AddOneShotScriptEventHandler(102u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose));
                    this.mSMCDeath.RequestState(true, "y", "PoseStarvation");
                    this.mSMCDeath.RequestState(true, "y", "StarvationToFloat");
                    this.mSMCDeath.RequestState(false, "y", "GhostFloating");
                    this.StopGhostExplosion();
                    break;

                case SimDescription.DeathType.Electrocution:
                case SimDescription.DeathType.BluntForceTrauma:
                case SimDescription.DeathType.Ranting:
                    this.StartGhostExplosion();
                    this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose));
                    this.mSMCDeath.AddOneShotScriptEventHandler(102u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose));
                    this.mSMCDeath.RequestState(true, "y", "PoseElectrocution");
                    this.mSMCDeath.RequestState(true, "y", "ElectrocutionToFloat");
                    this.mSMCDeath.RequestState(false, "y", "GhostFloating");
                    this.StopGhostExplosion();
                    break;

                case SimDescription.DeathType.Burn:
                case SimDescription.DeathType.MummyCurse:
                case SimDescription.DeathType.Meteor:
                case SimDescription.DeathType.Thirst:
                case SimDescription.DeathType.Transmuted:
                case SimDescription.DeathType.HauntingCurse:
                case SimDescription.DeathType.JellyBeanDeath:
                case SimDescription.DeathType.Jetpack:
                    this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackSimToGhostEffectNoFadeOut));
                    this.mSMCDeath.AddOneShotScriptEventHandler(102u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose));
                    this.mSMCDeath.RequestState(true, "y", "PoseElectrocution");
                    this.mSMCDeath.RequestState(true, "y", "ElectrocutionToFloat");
                    this.mSMCDeath.RequestState(false, "y", "GhostFloating");
                    break;

                case SimDescription.DeathType.Freeze:
                    this.StartGhostExplosion();
                    this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose));
                    this.mSMCDeath.AddOneShotScriptEventHandler(102u, new SacsEventHandler(this.EventCallbackFadeBodyFromPose));
                    this.mSMCDeath.RequestState(true, "y", "PoseFreeze");
                    this.mSMCDeath.RequestState(true, "y", "FreezeToFloat");
                    this.mSMCDeath.RequestState(false, "y", "GhostFloating");
                    break;

                case SimDescription.DeathType.MermaidDehydrated:
                    this.MermaidDehydratedToGhostSequence();
                    break;
                }
                if (this.Target.SimDescription.DeathStyle != SimDescription.DeathType.OldAge)
                {
                    this.Target.SetPosition(this.mGhostPosition);
                }
                this.mGrave.GhostSetup(this.Target, false);
                this.Target.SetHiddenFlags(HiddenFlags.Nothing);
                this.Target.FadeIn();
                base.RequestWalkStyle(Sim.WalkStyle.DeathWalk);
                string name = Localization.LocalizeString(this.Target.SimDescription.IsFemale, "Gameplay/Actors/Sim/ReapSoul:InteractionName", new object[0]);
                if (base.BeginSocialInteraction(new SocialInteractionB.DefinitionDeathInteraction(name, false), true, 1.25f, false))
                {
                    if (this.Target.SimDescription.DeathStyle != (SimDescription.DeathType) 69u && this.Target.Household != null && this.Target.IsInActiveHousehold)
                    {
                        this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.UnluckyStarted;
                        if (this.Target.SimDescription.DeathStyle == SimDescription.DeathType.OldAge)
                        {
                            this.Target.Motives.SetValue(CommodityKind.VampireThirst, -50f);
                        }
                        this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackResurrectSimUnlucky));
                        this.mSMCDeath.RequestState(false, "x", "Unlucky");
                        this.mSMCDeath.RequestState(true, "y", "Unlucky");
                        this.mSMCDeath.RequestState(false, "x", "Exit");
                        this.mSMCDeath.RequestState(true, "y", "Exit");
                        this.GrimReaperPostSequenceCleanup();
                        this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.Complete;
                        return(true);
                    }
                    if (this.Target.SimDescription.DeathStyle == (SimDescription.DeathType) 76u && this.Target.TraitManager != null && !this.Target.TraitManager.HasElement(TraitNames.ThereAndBackAgain))
                    {
                        this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.UnluckyStarted;
                        this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackResurrectSimRanting));
                        this.mSMCDeath.RequestState(false, "x", "Unlucky");
                        this.mSMCDeath.RequestState(true, "y", "Unlucky");
                        this.mSMCDeath.RequestState(false, "x", "Exit");
                        this.mSMCDeath.RequestState(true, "y", "Exit");
                        this.GrimReaperPostSequenceCleanup();
                        this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.Complete;
                        return(true);
                    }
                    this.mDeathFlower = this.Target.Inventory.Find <DeathFlower>();
                    if (this.mDeathFlower != null)
                    {
                        this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.DeathFlowerStarted;
                        this.Target.Inventory.RemoveByForce(this.mDeathFlower);
                        this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackResurrectSimDeathFlower));
                        this.mSMCDeath.RequestState(false, "x", "DeathFlower");
                        this.mSMCDeath.RequestState(true, "y", "DeathFlower");
                        this.mDeathFlower.Destroy();
                        this.mDeathFlower = null;
                        this.mSMCDeath.RequestState(false, "x", "Exit");
                        this.mSMCDeath.RequestState(true, "y", "Exit");
                        this.GrimReaperPostSequenceCleanup();
                        this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.Complete;
                        return(true);
                    }
                    if (this.Target.SimDescription.DeathStyle != SimDescription.DeathType.OldAge)
                    {
                        this.Actor.AddInteraction(GrimReaperSituation.ChessChallenge.Singleton);
                    }
                    this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.NormalStarted;
                    if (RandomUtil.CoinFlip())
                    {
                        this.mSMCDeath.RequestState(false, "x", "Accept");
                        this.mSMCDeath.RequestState(true, "y", "Accept");
                        Route route2 = this.Target.CreateRouteTurnToFace(this.mGrave.Position);
                        route2.ExecutionFromNonSimTaskIsSafe = true;
                        this.Target.DoRoute(route2);
                    }
                    else if (RandomUtil.CoinFlip())
                    {
                        this.mSMCDeath.RequestState(false, "x", "Reject");
                        this.mSMCDeath.RequestState(true, "y", "Reject");
                        Route route3 = this.Target.CreateRouteTurnToFace(this.mGrave.Position);
                        route3.ExecutionFromNonSimTaskIsSafe = true;
                        this.Target.DoRoute(route3);
                        this.mSMCDeath.RequestState(false, "x", "GhostJumpInGrave");
                        this.mSMCDeath.RequestState(true, "y", "GhostJumpInGrave");
                    }
                    else
                    {
                        this.mSMCDeath.RequestState(false, "x", "GhostKickedDive");
                        this.mSMCDeath.RequestState(true, "y", "GhostKickedDive");
                        this.mSMCDeath.RequestState(false, "x", "Kicked");
                        this.mSMCDeath.RequestState(true, "y", "Kicked");
                    }
                    this.mSMCDeath.RequestState(false, "y", "Exit");
                    this.mSMCDeath.RequestState(true, "x", "Exit");
                }
                else
                {
                    this.mDeathFlower = this.Target.Inventory.Find <DeathFlower>();
                    if (this.Target.SimDescription.DeathStyle != (SimDescription.DeathType) 69u && this.Target.Household != null && this.Target.IsInActiveHousehold)
                    {
                        this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.UnluckyStarted;
                        this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackResurrectSimUnlucky));
                        this.mSMCDeath.RequestState(false, "x", "Unlucky");
                        this.mSMCDeath.RequestState(true, "y", "Unlucky");
                        this.mSMCDeath.RequestState(false, "x", "Exit");
                        this.mSMCDeath.RequestState(true, "y", "Exit");
                        this.GrimReaperPostSequenceCleanup();
                        this.Target.AddExitReason(ExitReason.HigherPriorityNext);
                        this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.Complete;
                        return(true);
                    }
                    if (this.mDeathFlower != null)
                    {
                        this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.DeathFlowerStarted;
                        this.Target.Inventory.RemoveByForce(this.mDeathFlower);
                        this.mSMCDeath.AddOneShotScriptEventHandler(101u, new SacsEventHandler(this.EventCallbackResurrectSimDeathFlower));
                        this.mSMCDeath.RequestState(false, "x", "Unlucky");
                        this.mSMCDeath.RequestState(true, "y", "Unlucky");
                        this.mDeathFlower.Destroy();
                        this.mDeathFlower = null;
                        this.mSMCDeath.RequestState(false, "x", "Exit");
                        this.mSMCDeath.RequestState(true, "y", "Exit");
                        this.GrimReaperPostSequenceCleanup();
                        this.Target.AddExitReason(ExitReason.HigherPriorityNext);
                        this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.Complete;
                        return(true);
                    }
                    this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.NormalStarted;
                    this.mSMCDeath.RequestState("x", "ExitNoSocial");
                    this.Target.FadeOut();
                    this.mDeathEffect = this.mGrave.GetSimToGhostEffect(this.Target, this.mGrave.Position);
                    this.mSMCDeath.SetEffectActor("deathEffect", this.mDeathEffect);
                    this.mDeathEffect.Start();
                }
                this.mSituation.CheckAndSetPetSavior(this.Target);
                this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.NormalStarted;
                this.FinalizeDeath();
                this.GrimReaperPostSequenceCleanup();
                this.Target.StartOneShotFunction(new Sims3.Gameplay.Function(this.ReapSoulCallback), GameObject.OneShotFunctionDisposeFlag.OnDispose);
                this.mDeathProgress = GrimReaperSituation.ReapSoul.DeathProgress.Complete;
            }
            catch (Exception exception)
            {
                NiecException.PrintMessage("Sxception " + exception.Message + NiecException.NewLine + exception.StackTrace);
            }
            return(true);
        }
Ejemplo n.º 29
0
            /*
             * [Tunable]
             * [TunableComment("Range: Fun/Stress motive amount.  Description:  Amount of stress that a Sim gets when seeing another Sim die.")]
             * public static float kWitnessDeathStressPenalty = -50f;
             *
             * [Tunable]
             * [TunableComment("Range: Float multiplier.  Description:  Multiplier on additional stress when a family member of loved one sees a Sim die.")]
             * public static float kWitnessDeathRelationshipMultiplier = 1.5f;
             *
             * [TunableComment("Range: Fun/Stress motive amount.  Description:  Amount of fun that a Sim gets when seeing an enemy Sim die.")]
             * [Tunable]
             * public static float kWitnessEnemyDeathFunGain = 50f;
             *
             */



            public override bool Run()
            {
                SwimmingInPool swimmingInPool = Actor.Posture as SwimmingInPool;

                if (swimmingInPool != null && !swimmingInPool.ContainerPool.RouteToEdge(Actor))
                {
                    return(false);
                }
                SwimmingInPool swimmingInPool2 = Target.Posture as SwimmingInPool;

                if (swimmingInPool2 != null)
                {
                    if (!swimmingInPool2.ContainerPool.RouteToEdge(Actor))
                    {
                        return(false);
                    }
                    Actor.RouteTurnToFace(Target.Position);
                }

                else if (!GlobalFunctions.ObjectsWithinRadiusOfEachOther(Actor, Target, 2f))
                {
                    if (Actor == null || Target == null || Target.LotCurrent == null)
                    {
                        return(false);
                    }

                    Route route = Actor.CreateRoute();
                    if (route == null)
                    {
                        return(false);
                    }

                    RequestWalkStyle(Sim.WalkStyle.Run);

                    route.PlanToPointRadialRange(Target.Position, 2f, 6f, RouteDistancePreference.PreferNearestToRouteDestination, RouteOrientationPreference.TowardsObject, Target.LotCurrent.LotId, new int[1]
                    {
                        Target.RoomId
                    });

                    if (Actor == null || !Actor.DoRoute(route))
                    {
                        return(false);
                    }
                    UnrequestWalkStyle(Sim.WalkStyle.Run);
                }
                else
                {
                    Actor.RouteTurnToFace(Target.Position);
                }
                if (Simulator.CheckYieldingContext(false))
                {
                    Simulator.Sleep(20);
                }
                if (Target.SimDescription == null || !Target.SimDescription.IsValidDescription)
                {
                    return(true);
                }
                NFinalizeDeath.CheckYieldingContext();
                StateMachineClient stateMachineClient = StateMachineClient.Acquire(Actor, "DeathReactions");

                stateMachineClient.SetActor("x", Actor);
                stateMachineClient.EnterState("x", "Enter");
                BeginCommodityUpdates();
                bool flag  = false;
                bool flag2 = false;

                //bool flag3 = false;

                LTRData.RelationshipClassification relationshipClassification = LTRData.RelationshipClassification.Low;
                Relationship relationship = Relationship.Get(Actor, Target, false);

                if (relationship != null)
                {
                    relationshipClassification = LTRData.Get(relationship.LTR.CurrentLTR).RelationshipClass;
                }

                if (Actor == null || Target == null || Actor.Genealogy == null || Target.Genealogy == null)
                {
                    return(true);
                }

                if (relationshipClassification == LTRData.RelationshipClassification.High || Actor.Genealogy.IsBloodRelated(Target.Genealogy))
                {
                    if (relationship != null && relationship.AreRomantic() && relationship.LTR.IsPositive)
                    {
                        flag2 = true;
                    }
                    else
                    {
                        flag = true;
                    }
                    //flag3 = true;
                }
                NFinalizeDeath.CheckYieldingContext();
                switch (Actor.SimDescription.Species)
                {
                case CASAgeGenderFlags.None:
                case CASAgeGenderFlags.Human:
                    if (!Actor.IsInActiveHousehold)
                    {
                        stateMachineClient.RequestState("x", "Shocked");
                        NFinalizeDeath.CheckYieldingContext();
                        if (RandomUtil.RandomChance(25))
                        {
                            stateMachineClient.RequestState("x", "Evil");
                        }
                        else
                        {
                            stateMachineClient.RequestState("x", "LovedOneLoop");
                        }
                        flag  = true;
                        flag2 = true;
                        //flag3 = true;
                    }
                    else
                    {
                        stateMachineClient.RequestState("x", "Shocked");
                        NFinalizeDeath.CheckYieldingContext();
                        Actor.Motives.ChangeValue(CommodityKind.Fun, kWitnessDeathStressPenalty);
                        stateMachineClient.RequestState("x", "BasicLoop");
                        flag  = false;
                        flag2 = false;
                        //flag3 = false;
                    }

                    break;

                case CASAgeGenderFlags.Dog:
                case CASAgeGenderFlags.LittleDog:
                    stateMachineClient.RequestState("x", "Dog");
                    break;

                case CASAgeGenderFlags.Cat:
                    stateMachineClient.RequestState("x", "Cat");
                    break;

                case CASAgeGenderFlags.Horse:
                    stateMachineClient.RequestState("x", "Horse");
                    break;
                }
                EventTracker.SendEvent(EventTypeId.kSawSimDie, Actor, Target);
                DoLoop(ExitReason.Default, __LoopDel, stateMachineClient);
                EndCommodityUpdates(true);
                if (Actor.IsInActiveHousehold)
                {
                    if (Actor.BuffManager == null)
                    {
                        return(false);
                    }

                    if (flag2 && Target.SimDescription.DeathStyle != 0)
                    {
                        Actor.BuffManager.AddElement(BuffNames.HeartBroken, Origin.FromWitnessingDeath);
                        BuffHeartBroken.BuffInstanceHeartBroken buffInstanceHeartBroken = Actor.BuffManager.GetElement(BuffNames.HeartBroken) as BuffHeartBroken.BuffInstanceHeartBroken;
                        if (buffInstanceHeartBroken != null)
                        {
                            buffInstanceHeartBroken.MissedSim = Target.SimDescription;
                        }
                    }
                    else if (flag && Target.SimDescription.DeathStyle != 0)
                    {
                        Actor.BuffManager.AddElement(BuffNames.Mourning, Urnstone.CalculateMourningMoodStrength(Actor, Target.SimDescription), Origin.FromWitnessingDeath);
                        BuffMourning.BuffInstanceMourning buffInstanceMourning = Actor.BuffManager.GetElement(BuffNames.Mourning) as BuffMourning.BuffInstanceMourning;
                        if (buffInstanceMourning != null)
                        {
                            buffInstanceMourning.MissedSim = Target.SimDescription;
                        }
                    }
                }
                else
                {
                    if (Actor.BuffManager == null)
                    {
                        return(false);
                    }
                    if (flag2)
                    {
                        Actor.BuffManager.AddElement(BuffNames.HeartBroken, Origin.FromWitnessingDeath);
                        BuffHeartBroken.BuffInstanceHeartBroken buffInstanceHeartBroken = Actor.BuffManager.GetElement(BuffNames.HeartBroken) as BuffHeartBroken.BuffInstanceHeartBroken;
                        if (buffInstanceHeartBroken != null)
                        {
                            buffInstanceHeartBroken.MissedSim = Target.SimDescription;
                        }
                    }
                    else if (flag)
                    {
                        Actor.BuffManager.AddElement(BuffNames.Mourning, Urnstone.CalculateMourningMoodStrength(Actor, Target.SimDescription), Origin.FromWitnessingDeath);
                        BuffMourning.BuffInstanceMourning buffInstanceMourning = Actor.BuffManager.GetElement(BuffNames.Mourning) as BuffMourning.BuffInstanceMourning;
                        if (buffInstanceMourning != null)
                        {
                            buffInstanceMourning.MissedSim = Target.SimDescription;
                        }
                    }
                }
                NFinalizeDeath.CheckYieldingContext();
                stateMachineClient.RequestState("x", "Exit");
                stateMachineClient.Dispose();
                //if (!NFinalizeDeath.IsAllActiveHousehold_SimObject(Actor) &&
                //        !NFinalizeDeath.IsAllActiveHousehold_SimObject(Target) &&
                //        !(Actor.SimDescription.Service is GrimReaper) &&
                //        !(Target.SimDescription.Service is GrimReaper) &&
                //        RandomUtil.RandomChance(70)
                //)
                //return NFinalizeDeath.ForceNHSReapSoul(Target, Actor);

                return(true);
            }
Ejemplo n.º 30
0
        public override bool Run()
        {
            try
            {
                if (!Target.RouteToWorkbench(Actor))
                {
                    return(false);
                }

                mMakeFemale  = Target.mIsMakingFemaleFrankensim;
                mInventSkill = Actor.SkillManager.AddElement(SkillNames.Inventing) as InventingSkill;
                bool flag = Target.mInventionProgress > 0f;
                if (!flag)
                {
                    Definition interactionDefinition = InteractionDefinition as Definition;
                    mMakeFemale = interactionDefinition.MakeFemale;
                    Target.mIsMakingFemaleFrankensim = mMakeFemale;
                    ConsumeIngredients();
                }

                StandardEntry();
                Target.mIsMakingFrankensim      = true;
                Target.mFrankenSimInventorSimId = Actor.SimDescription.SimDescriptionId;
                StartStages();
                mTimeUntilModelSwap = GetTimeForNextModelChange();
                EnterStateMachine("WorkbenchInvention", "Enter", "x", "workstation");
                SetParameter("shouldSwipe", !flag);
                SetParameter("skillLevel", InventionWorkbench.GetSkillLevelParam(mInventSkill));
                if (!flag)
                {
                    AddSynchronousOneShotScriptEventHandler(0x67, OnAnimationEvent);
                }

                mTotalTime = GetTimeToCompletion();
                AnimateSim("Loop Invent");
                BeginCommodityUpdates();
                if (Actor.SimDescription.TeenOrAbove)
                {
                    Actor.SkillManager.StartGainWithoutSkillMeter(SkillNames.Handiness, InventionWorkbench.kHandinessSkillGainRateDuringMake, true);
                }

                bool succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), MakeLoopCallback, mCurrentStateMachine);
                if (Actor.SimDescription.TeenOrAbove)
                {
                    Actor.SkillManager.StopSkillGain(SkillNames.Handiness);
                }

                EndCommodityUpdates(succeeded);
                AnimateSim("Exit");
                if (!mRecipeKnown && !Actor.OpportunityManager.HasOpportunity(OpportunityNames.EP2_SkillInventing_Frankensim4))
                {
                    Target.ScrapCurrentInvention();
                }

                if (Target.mInventionProgress >= 1f)
                {
                    Sims3.Gameplay.Gameflow.SetGameSpeed(Sims3.Gameplay.Gameflow.GameSpeed.Normal, Sims3.Gameplay.Gameflow.SetGameSpeedContext.Gameplay);
                    RouteAwayFromTable();
                    Target.mDummyModel.UnParent();
                    Target.mDummyModel.Destroy();
                    Target.mDummyModel               = null;
                    Target.mInventionProgress        = 0f;
                    Target.mIsMakingFrankensim       = false;
                    Target.mFrankenSimInventorSimId  = 0x0L;
                    Target.mIsMakingFemaleFrankensim = false;
                    Target.mWasFinishedByGnome       = false;
                    Target.mIsMakingCheapToy         = false;
                    CASAgeGenderFlags gender = mMakeFemale ? CASAgeGenderFlags.Female : CASAgeGenderFlags.Male;
                    mFrankensim = OccultFrankenstein.CreateFrankenStein(Actor, gender);
                    mFrankensim.FadeOut(false, false, 0f);
                    mFrankensim.GreetSimOnLot(Target.LotCurrent);
                    mFrankensim.SetPosition(Target, Slot.RoutingSlot_1);
                    mFrankensim.SetForward((Vector3)(Slots.GetForwardOfSlot(Target.ObjectId, Slot.RoutingSlot_1) * -1f));
                    mFrankensim.AddToWorld();
                    InventingSkill skill = Actor.SkillManager.GetSkill <InventingSkill>(SkillNames.Inventing);
                    if (!skill.OppKnowFrankensimRecipeCompleted)
                    {
                        EventTracker.SendEvent(EventTypeId.kDiscoveredNewInvention, Actor, mFrankensim);
                    }
                    mCurrentStateMachine = StateMachineClient.Acquire(mFrankensim, "WorkbenchFrankensim", AnimationPriority.kAPDefault);
                    SetActor("workstation", Target);
                    SetActor("x", mFrankensim);
                    SetActor("y", Actor);
                    AddSynchronousOneShotScriptEventHandler(0x65, OnAnimationEvent);
                    EnterState("x", "Enter");
                    AnimateSim("Exit");
                    AdoptFrankenSim(Actor, mFrankensim);
                    skill.KnowsFrankensimRecipe = true;
                    skill.TestForNewLifetimeOpp();
                    EventTracker.SendEvent(EventTypeId.kFrankensimLearned, Actor);
                }

                StandardExit();
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }