public override bool Run()
        {
            try
            {
                ISaunaWooHooDefinition definition = InteractionDefinition as ISaunaWooHooDefinition;

                if (!StartSync())
                {
                    DoResume();
                    return(false);
                }

                StandardEntry(false);
                mSauna = Actor.Posture.Container as SaunaClassic;
                if (Actor == mSauna.GetLeftSim())
                {
                    IHasSeatingGroup container = Actor.Posture.Container as IHasSeatingGroup;
                    Seat             seat      = container.SeatingGroup[Actor];
                    Seat             seat2     = container.SeatingGroup[Target];
                    if ((seat == null) || (seat2 == null))
                    {
                        Actor.AddExitReason(ExitReason.FailedToStart);
                        return(false);
                    }

                    // Custom
                    string socialName = CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor);

                    ReturnInstance.EnsureMaster();
                    mCurrentStateMachine = ReturnInstance.mCurrentStateMachine;
                    StartSocial(socialName);
                    InitiateSocialUI(Actor, Target);
                    SaunaClassic.CuddleSeatedWooHooSauna linkedInteractionInstance = LinkedInteractionInstance as SaunaClassic.CuddleSeatedWooHooSauna;
                    linkedInteractionInstance.Rejected = Rejected;
                    if (Rejected)
                    {
                        mCurrentStateMachine.RequestState(null, "Woo Hoo Reject");
                        mCurrentStateMachine.RequestState(null, "ExitSitting");
                        FinishSocial(socialName, true);
                        FinishSocialContext();
                        Actor.BuffManager.AddElement(BuffNames.WalkOfShame, Origin.FromRejectedWooHooOffHome);
                    }
                    else
                    {
                        mCurrentStateMachine.RequestState(null, "ExitSitting");

                        // Custom
                        CommonWoohoo.TestNakedOutfit(Woohooer.Settings.mNakedOutfitSaunaWoohoo, Actor, Target);

                        if (Stand.Singleton.CreateInstance(mSauna, Actor, Actor.InheritedPriority(), false, false).RunInteraction())
                        {
                            // Custom
                            if (CommonWoohoo.NeedPrivacy(false, Actor, Target))
                            {
                                mSituation     = new WooHoo.WooHooPrivacySituation(this);
                                mPrivacyFailed = !mSituation.Start();
                            }
                            else
                            {
                                mPrivacyFailed = false;
                            }

                            linkedInteractionInstance.mPrivacyFailed = mPrivacyFailed;
                            if (!mPrivacyFailed && Actor.RouteToSlot(mSauna, Slot.RoutingSlot_14))
                            {
                                EnterStateMachine("Sauna_store", "SimEnter", "x");
                                SetActor("saunaX", seat.Host);
                                SetActor("saunaY", seat2.Host);
                                AddOneShotScriptEventHandler(0x384, OnAnimationEvent);
                                AnimateSim("PourWater");
                                AnimateSim("SimExit");

                                if (SaunaSit.WoohooSingleton.CreateInstance(mSauna, Actor, Actor.InheritedPriority(), false, false).RunInteraction())
                                {
                                    RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                                    EnterStateMachine("sauna_store", "SimEnter", "x", "y");
                                    SetActor("saunaX", mSauna);
                                    mCurrentStateMachine.AddOneShotScriptEventHandler(0x6e, OnAnimationEvent);
                                    mCurrentStateMachine.AddOneShotScriptEventHandler(0x6f, OnAnimationEvent);
                                    mCurrentStateMachine.AddOneShotScriptEventHandler(0x78, OnAnimationEvent);
                                    mCurrentStateMachine.AddOneShotScriptEventHandler(0x79, OnAnimationEvent);
                                    mCurrentStateMachine.AddOneShotScriptEventHandler(0x70, OnBabyCheckEventEx);

                                    SetActor("saunaX", seat.Host);
                                    SetActor("saunaY", seat2.Host);
                                    if (Actor == mSauna.GetLeftSim())
                                    {
                                        SetParameter("IsMirrored", true);
                                        SetParameter("SuffixX", mSauna.mSeatingGroup[Actor].IKSuffix);
                                        SetParameter("SuffixY", mSauna.mSeatingGroup[Target].IKSuffix);
                                    }
                                    else
                                    {
                                        SetParameter("IsMirrored", false);
                                        SetParameter("SuffixY", mSauna.mSeatingGroup[Actor].IKSuffix);
                                        SetParameter("SuffixX", mSauna.mSeatingGroup[Target].IKSuffix);
                                    }

                                    AnimateJoinSims("Woohoo");
                                    AnimateJoinSims("SimExit");
                                    RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);

                                    // Custom
                                    CommonWoohoo.RunPostWoohoo(Actor, Target, mSauna, definition.GetStyle(this), definition.GetLocation(mSauna), true);

                                    Target.Motives.ChangeValue(CommodityKind.Fun, SaunaClassic.kWooHooFunBump);
                                    Target.Motives.ChangeValue(CommodityKind.Social, SaunaClassic.kWooHooSocialBump);
                                    Target.Motives.ChangeValue(CommodityKind.Hygiene, SaunaClassic.kWooHooHygieneBump);
                                    Actor.Motives.ChangeValue(CommodityKind.Fun, SaunaClassic.kWooHooFunBump);
                                    Actor.Motives.ChangeValue(CommodityKind.Social, SaunaClassic.kWooHooSocialBump);
                                    Actor.Motives.ChangeValue(CommodityKind.Hygiene, SaunaClassic.kWooHooHygieneBump);
                                }
                            }
                        }

                        FinishSocial(socialName, true);
                        Actor.AddExitReason(ExitReason.StageComplete);
                        Target.AddExitReason(ExitReason.StageComplete);
                    }
                }
                else
                {
                    DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                }

                FinishLinkedInteraction(IsMaster);
                bool succeeded = !Rejected && !mPrivacyFailed;
                EndCommodityUpdates(succeeded);
                StandardExit(false, false);
                InvokeDoResumeOnCleanup = false;
                if (!mPrivacyFailed)
                {
                    Actor.SimDescription.SetFirstWooHoo();
                }

                if ((Rejected && !IsMaster) && Stand.Singleton.CreateInstance(mSauna, Actor, Actor.InheritedPriority(), false, false).RunInteraction())
                {
                    Actor.PlayReaction(ReactionTypes.Embarrassed, ReactionSpeed.AfterInteraction);
                }

                WaitForSyncComplete();
                return(!Rejected);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
示例#2
0
        public override bool Run()
        {
            try
            {
                if (!StartSync())
                {
                    return(false);
                }

                bool flag2 = false;

                StandardEntry(false);
                BeginCommodityUpdates();

                bool succeeded = false;

                try
                {
                    if (IsMaster)
                    {
                        HotTubBase container = Actor.Posture.Container as HotTubBase;
                        container.mSimsAreWooHooing = true;
                        ReturnInstance.EnsureMaster();
                        mCurrentStateMachine = ReturnInstance.mCurrentStateMachine;

                        IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;;

                        string socialName = CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor);
                        StartSocial(socialName);

                        Actor.SocialComponent.StartSocializingWith(Target);

                        Dictionary <Sim, SocialRule> effects = new Dictionary <Sim, SocialRule>();
                        SocialEffect = Actor.Conversation.UpdateOnSelectingInteraction(Actor, Target, Autonomous, CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor), null, null, effects);
                        Rejected     = (SocialEffect == null) || (!SocialEffect.LHS.IsSocialAccepted());

                        InitiateSocialUI(Actor, Target);
                        (LinkedInteractionInstance as NestedCuddleInteraction).Rejected = Rejected;
                        if (Rejected)
                        {
                            mCurrentStateMachine.RequestState(null, "Woo Hoo Reject");
                            mCurrentStateMachine.RequestState(null, "ExitSitting");
                            FinishSocial(socialName, true);
                            FinishSocialContext();
                            Actor.BuffManager.AddElement(BuffNames.WalkOfShame, Origin.FromRejectedWooHooOffHome);
                        }
                        else
                        {
                            if (CommonWoohoo.NeedPrivacy(false, Actor, Target))
                            {
                                mSituation = new WooHoo.WooHooPrivacySituation(this);
                                flag2      = !mSituation.Start();
                            }

                            if (!flag2)
                            {
                                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                                mCurrentStateMachine.AddOneShotScriptEventHandler(0x6e, OnAnimationEvent);
                                mCurrentStateMachine.AddOneShotScriptEventHandler(0x6f, OnAnimationEvent);
                                mCurrentStateMachine.AddOneShotScriptEventHandler(0x78, OnAnimationEvent);
                                mCurrentStateMachine.AddOneShotScriptEventHandler(0x79, OnAnimationEvent);
                                mCurrentStateMachine.AddOneShotScriptEventHandler(0x70, OnBabyCheck);

                                mCurrentStateMachine.RequestState(null, "Woo Hoo Accept");
                                PuddleManager.AddPuddle(Actor.Posture.Container.Position);
                                RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);

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

                            FinishSocial(socialName, true);
                        }
                    }
                    else
                    {
                        DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                    }
                    FinishLinkedInteraction(IsMaster);
                    succeeded = !Rejected && !flag2;
                }
                finally
                {
                    EndCommodityUpdates(succeeded);
                    StandardExit(false, false);
                }

                if (Rejected)
                {
                    InvokeDoResumeOnCleanup = false;
                }
                else if (!mPrivacyFailed)
                {
                    Actor.SimDescription.SetFirstWooHoo();
                }

                WaitForSyncComplete();
                return(!Rejected);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
示例#3
0
        public override bool Run()
        {
            try
            {
                Actor.GreetSimOnMyLotIfPossible(Target);

                if (StartBedCuddleA.GetCuddleType(Actor, Target) == StartBedCuddleA.CuddleType.CuddleTargetOnDifferentBed)
                {
                    ChildUtils.SetPosturePrecondition(this, CommodityKind.Relaxing, new CommodityKind[] { CommodityKind.NextToTarget });
                    Actor.InteractionQueue.PushAsContinuation(this, true);

                    return(true);
                }

                BedMultiPart container = null;

                try
                {
                    if (Actor.Posture == null)
                    {
                        return(false);
                    }

                    if (!Actor.Posture.Satisfies(CommodityKind.Relaxing, null))
                    {
                        return(false);
                    }

                    if (!SafeToSync())
                    {
                        return(false);
                    }

                    container = Actor.Posture.Container as BedMultiPart;

                    if (container == null)
                    {
                        return(false);
                    }

                    if (IsMaster && ReturnInstance == null)
                    {
                        EnterStateMachine("BedSocials", "FromRelax", "x", "y");
                        AddPersistentScriptEventHandler(0x0, EventCallbackChangeVisibility);
                        SetActor("bed", container);
                        container.PartComp.GetPartSimIsIn(Actor).SetPartParameters(mCurrentStateMachine);
                        WooHoo interaction = InteractionDefinition.CreateInstance(Actor, Target, GetPriority(), false, CancellableByPlayer) as WooHoo;
                        interaction.IsMaster = false;
                        interaction.LinkedInteractionInstance = this;
                        ChildUtils.SetPosturePrecondition(interaction, CommodityKind.Relaxing, new CommodityKind[] { CommodityKind.NextToTarget });
                        Target.InteractionQueue.AddNext(interaction);

                        if (Target.Posture.Container != Actor.Posture.Container)
                        {
                            Actor.LookAtManager.SetInteractionLookAt(Target, 0xc8, LookAtJointFilter.TorsoBones);
                            Actor.Posture.CurrentStateMachine.RequestState("x", "callOver");
                        }

                        Actor.SynchronizationLevel  = Sim.SyncLevel.Started;
                        Actor.SynchronizationTarget = Target;
                        Actor.SynchronizationRole   = Sim.SyncRole.Initiator;

                        if (!StartSync(IsMaster))
                        {
                            return(false);
                        }

                        if (!Actor.WaitForSynchronizationLevelWithSim(Target, Sim.SyncLevel.Routed, 30f))
                        {
                            return(false);
                        }

                        Actor.SocialComponent.StartSocializingWith(Target);
                    }
                    else if (!StartSync(IsMaster))
                    {
                        return(false);
                    }
                }
                catch (ResetException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    Common.DebugException(Actor, Target, e);
                    return(false);
                }

                StandardEntry(false);
                BeginCommodityUpdates();
                bool succeeded = false;

                try
                {
                    if (IsMaster)
                    {
                        if (CommonWoohoo.NeedPrivacy(container.InherentlyProvidesPrivacy, Actor, Target))
                        {
                            mSituation = new WooHooPrivacySituation(this);

                            if (!mSituation.Start())
                            {
                                FinishLinkedInteraction();
                                PostLoop();

                                if (ReturnInstance == null)
                                {
                                    InteractionInstance instance = BedRelax.Singleton.CreateInstance(Actor.Posture.Container, Actor, GetPriority(), true, true);
                                    Actor.InteractionQueue.PushAsContinuation(instance, true);
                                }
                                else
                                {
                                    DoResume();
                                }

                                WooHoo linkedInteractionInstance = LinkedInteractionInstance as WooHoo;

                                if (linkedInteractionInstance != null)
                                {
                                    if (ReturnInstance == null)
                                    {
                                        InteractionInstance instance2 = BedRelax.Singleton.CreateInstance(Target.Posture.Container, Target, GetPriority(), true, true);
                                        Target.InteractionQueue.PushAsContinuation(instance2, true);
                                    }
                                    else
                                    {
                                        linkedInteractionInstance.DoResume();
                                    }

                                    linkedInteractionInstance.Failed = true;
                                }

                                WaitForSyncComplete();

                                return(false);
                            }
                        }

                        IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;
                        Actor.LookAtManager.ClearInteractionLookAt();
                        Target.LookAtManager.ClearInteractionLookAt();

                        if (ReturnInstance != null)
                        {
                            ReturnInstance.EnsureMaster();
                            mCurrentStateMachine = ReturnInstance.mCurrentStateMachine;
                        }

                        StartSocial(CommonSurrogate.GetSocialName(definition.GetStyle(this)));
                        InitiateSocialUI(Actor, Target);
                        WooHoo linked = LinkedInteractionInstance as WooHoo;

                        if (linked != null)
                        {
                            linked.Rejected = Rejected;
                        }

                        if (Rejected)
                        {
                            if (Actor.Posture.Container == Target.Posture.Container)
                            {
                                ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.DoubleBalloonData("balloon_woohoo", "balloon_question");
                                bd.BalloonType = ThoughtBalloonTypes.kSpeechBalloon;
                                Actor.ThoughtBalloonManager.ShowBalloon(bd);
                                AddOneShotScriptEventHandler(0x194, ShowRejectBalloonAndEnqueueRouteAway);
                                mCurrentStateMachine.RequestState(false, "x", "WooHooReject");
                                mCurrentStateMachine.RequestState(true, "y", "WooHooReject");
                                mCurrentStateMachine.RequestState(true, null, "ToRelax");
                            }
                        }
                        else
                        {
                            mCurrentStateMachine.AddOneShotScriptEventHandler(0x6e, OnPregnancyEvent);
                            mCurrentStateMachine.AddOneShotScriptEventHandler(0x6e, EventCallbackChangeClothes);
                            string wooHooEffectName = container.TuningBed.WooHooEffectName;

                            if (!string.IsNullOrEmpty(wooHooEffectName))
                            {
                                mWooHooEffect = VisualEffect.Create(wooHooEffectName);
                                mWooHooEffect.ParentTo(container, Slots.Hash("_FX_0"));
                                AddOneShotScriptEventHandler(0xc8, EventCallbackWooHoo);
                                AddOneShotScriptEventHandler(0xc9, EventCallbackWooHoo);
                            }

                            if (container is BedDreamPod)
                            {
                                AddOneShotScriptEventHandler(0xc8, EventCallbackDreamPodWooHoo);
                                AddOneShotScriptEventHandler(0xc9, EventCallbackDreamPodWooHoo);
                            }

                            Sim.ClothesChangeReason reason = Sim.ClothesChangeReason.GoingToBed;

                            if ((Woohooer.Settings.mNakedOutfitBed) && (!container.IsOutside))
                            {
                                reason = Sim.ClothesChangeReason.GoingToBathe;
                                Woohooer.Settings.AddChange(Actor);
                                Woohooer.Settings.AddChange(Target);
                            }

                            mHelperX = new Sim.SwitchOutfitHelper(Actor, reason);
                            mHelperY = new Sim.SwitchOutfitHelper(Target, reason);
                            mHelperX.Start();
                            mHelperY.Start();
                            mJealousyAlarm = AlarmManager.Global.AddAlarm(kJealousyBroadcasterDelay, TimeUnit.Minutes, StartJealousyBroadcaster, "StartJealousyBroadcaster", AlarmType.DeleteOnReset, container);
                            container.PreWooHooBehavior(Actor, Target, this);
                            mCurrentStateMachine.RequestState(false, "x", "WooHoo");
                            mCurrentStateMachine.RequestState(true, "y", "WooHoo");
                            container.PostWooHooBehavior(Actor, Target, this);
                            Relationship.Get(Actor, Target, true).STC.Update(Actor, Target, CommodityTypes.Amorous, kSTCIncreaseAfterWoohoo);

                            if (CanSleep(Actor, container))
                            {
                                SleepAfter = true;
                            }
                            else
                            {
                                SleepAfter = false;
                                container.PartComp.GetPartSimIsIn(Actor).BedMade = true;
                            }

                            if (CanSleep(Target, container))
                            {
                                (LinkedInteractionInstance as WooHoo).SleepAfter = true;
                            }
                            else
                            {
                                (LinkedInteractionInstance as WooHoo).SleepAfter  = false;
                                container.PartComp.GetPartSimIsIn(Target).BedMade = true;
                            }

                            /*
                             * if (SleepAfter)
                             * {
                             *  mCurrentStateMachine.RequestState(null, "ToSleep");
                             * }
                             * else*/
                            {
                                mCurrentStateMachine.RequestState(null, "ToRelax");
                            }

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

                            if (container is BedDoubleHover)
                            {
                                Actor.BuffManager.AddElement(BuffNames.MeterHighClub, Origin.FromWooHooOnHoverBed);
                                Target.BuffManager.AddElement(BuffNames.MeterHighClub, Origin.FromWooHooOnHoverBed);
                            }

                            if (container is BedDreamPod)
                            {
                                Actor.BuffManager.AddElement(BuffNames.DoubleDreaming, Origin.FromWooHooInDreamPod);
                                Target.BuffManager.AddElement(BuffNames.DoubleDreaming, Origin.FromWooHooInDreamPod);
                            }
                        }

                        FinishSocial(CommonSurrogate.GetSocialName(definition.GetStyle(this)), true);
                        CleanupSituation();
                        Actor.AddExitReason(ExitReason.Finished);
                    }
                    else
                    {
                        container = Target.Posture.Container as BedMultiPart;

                        if (container == null)
                        {
                            return(false);
                        }

                        PartComponent <BedData> partComp = container.PartComp;

                        if (partComp.GetSimInOtherPart(Target) == null)
                        {
                            int     num;
                            BedData otherPart = partComp.GetOtherPart(partComp.GetPartSimIsIn(Target));

                            if (!Actor.RouteToSlotListAndCheckInUse(container, otherPart.RoutingSlot, out num))
                            {
                                Actor.AddExitReason(ExitReason.RouteFailed);
                                return(false);
                            }

                            Actor.SynchronizationLevel = Sim.SyncLevel.Routed;

                            if (Rejected)
                            {
                                Actor.PlaySoloAnimation("a2a_bed_relax_cuddle_reject_standing_y", true);
                                Actor.RouteAway(kMinDistanceToMoveAwayWhenRejected, kMaxDistanceToMoveAwayWhenRejected, true,
                                                new InteractionPriority(InteractionPriorityLevel.Zero), false, true, true, RouteDistancePreference.NoPreference);

                                return(true);
                            }

                            if (!otherPart.RelaxOnBed(Actor, "Enter_BedRelax_" + otherPart.StateNameSuffix))
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            Actor.SynchronizationLevel = Sim.SyncLevel.Routed;
                        }

                        DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));

                        if (!Actor.HasExitReason(ExitReason.Finished))
                        {
                            PostLoop();
                            WaitForMasterInteractionToFinish();
                        }
                    }

                    PostLoop();
                    WaitForSyncComplete();

                    succeeded = !Failed && !Rejected;
                }
                finally
                {
                    EndCommodityUpdates(succeeded);
                    StandardExit(false, false);
                }

                if (succeeded)
                {
                    VisitSituation situation  = VisitSituation.FindVisitSituationInvolvingGuest(Actor);
                    VisitSituation situation2 = VisitSituation.FindVisitSituationInvolvingGuest(Target);

                    if (situation != null && situation2 != null)
                    {
                        situation.GuestStartingInappropriateAction(Actor, 3.5f);
                        situation2.GuestStartingInappropriateAction(Target, 3.5f);
                    }
                }

                if (succeeded && SleepAfter)
                {
                    if (!Actor.InteractionQueue.HasInteractionOfType(BedSleep.Singleton))
                    {
                        InteractionInstance instance = BedSleep.Singleton.CreateInstance(container, Actor, GetPriority(), Autonomous, CancellableByPlayer);
                        Actor.InteractionQueue.PushAsContinuation(instance, true);
                    }

                    if (VisitSituation.FindVisitSituationInvolvingGuest(Target) != null && Actor.IsAtHome)
                    {
                        SocialCallback.OnStayOver(Actor, Target, false);
                    }
                    else if (VisitSituation.FindVisitSituationInvolvingGuest(Actor) != null && Target.IsAtHome)
                    {
                        SocialCallback.OnStayOver(Target, Actor, false);
                    }
                }
                else if (!IsOwner(Actor, container))
                {
                    InteractionInstance instance = Actor.Posture.GetStandingTransition();

                    if (instance != null)
                    {
                        Actor.InteractionQueue.Add(instance);
                    }
                }

                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Woohooer.Settings.AddChange(Actor);
                Woohooer.Settings.AddChange(Target);
                Common.Exception(Actor, Target, e);

                return(false);
            }
        }
示例#4
0
        public override bool Run()
        {
            Common.StringBuilder msg = new Common.StringBuilder("ShowerWoohoo:Run" + Common.NewLine);

            try
            {
                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                Actor.BuffManager.RemoveElement(BuffNames.RobotForm);

                mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe);
                mSwitchOutfitHelper.Start();
                if (WaitForBToEnterShower)
                {
                    //Actor.RouteToObjectRadialRange(Shower, 1.5f, 4f);
                    SpeedTrap.Sleep(0xa);
                    while (Shower.SimInShower != Target)
                    {
                        if ((Target.InteractionQueue.GetCurrentInteraction() != TakeShowerInst) || Target.HasExitReason(ExitReason.Canceled))
                        {
                            mSwitchOutfitHelper.Dispose();
                            return(false);
                        }
                        SpeedTrap.Sleep(0xa);
                    }
                }

                msg += "A";

                if (!Actor.RouteToSlot(Shower, Slot.RoutingSlot_0))
                {
                    mSwitchOutfitHelper.Dispose();
                    return(false);
                }

                msg += "B";

                mSwitchOutfitHelper.Wait(true);
                bool flag = Actor.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed;
                Shower.AddToUseList(Actor);
                mInUseList           = true;
                mCurrentStateMachine = TakeShowerInst.mCurrentStateMachine;
                SetActorAndEnter("y", Actor, "Enter");
                if (!WaitForBToEnterShower)
                {
                    mCurrentStateMachine.RequestState("y", "Ask");
                }

                msg += "C";

                string socialName = CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor);
                StartSocial(socialName);

                if (WaitForBToEnterShower)
                {
                    Rejected = false;
                }

                InitiateSocialUI(Actor, Target);

                msg += "D";

                bool succeeded = true;
                if (Rejected)
                {
                    succeeded = false;
                    mCurrentStateMachine.RequestState("y", "Reject");
                    mCurrentStateMachine.RemoveActor(Actor);
                    FinishSocial(socialName, true);
                    Actor.BuffManager.AddElement(BuffNames.WalkOfShame, Origin.FromRejectedWooHooOffHome);
                }
                else
                {
                    mCurrentStateMachine.RequestState("y", "ShooSims");
                    SetParameter("SimShouldClothesChange", !flag && !Actor.OccultManager.DisallowClothesChange());
                    mSwitchOutfitHelper.AddScriptEventHandler(this);
                    Actor.LoopIdle();

                    msg += "E";

                    if (CommonWoohoo.NeedPrivacy(Shower.IsOutside, Actor, Target))
                    {
                        mSituation = new BedWoohoo.WooHooPrivacySituation(this);
                        if (!mSituation.Start())
                        {
                            mSwitchOutfitHelper.Dispose();
                            succeeded = false;
                        }
                    }

                    msg += "F";

                    if ((succeeded) && (Actor.RouteToSlot(Shower, Slot.RoutingSlot_0)))
                    {
                        MotiveDelta[] deltaArray = new MotiveDelta[6];
                        deltaArray[0] = AddMotiveDelta(CommodityKind.Fun, 1500f);
                        deltaArray[1] = TakeShowerInst.AddMotiveDelta(CommodityKind.Fun, 1500f);
                        deltaArray[2] = AddMotiveDelta(CommodityKind.Social, 50f);
                        deltaArray[3] = TakeShowerInst.AddMotiveDelta(CommodityKind.Social, 50f);
                        if (Actor.SimDescription.IsPlantSim)
                        {
                            deltaArray[4] = AddMotiveDelta(CommodityKind.Hygiene, 800f * Sims3.Gameplay.Objects.Plumbing.Shower.kPlantSimHygieneModifier);
                        }
                        else
                        {
                            deltaArray[4] = AddMotiveDelta(CommodityKind.Hygiene, 800f);
                        }

                        if (Actor.SimDescription.IsMermaid)
                        {
                            deltaArray[5] = AddMotiveDelta(CommodityKind.MermaidDermalHydration, 800f);
                        }

                        Target.EnableCensor(Sim.CensorType.FullHeight);
                        RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);
                        mCurrentStateMachine.AddOneShotScriptEventHandler(0x65, OnJealousyEvent);
                        mCurrentStateMachine.AddOneShotScriptEventHandler(0x66, OnAnimationEvent);

                        if (CommonPregnancy.IsSuccess(Actor, Target, Autonomous, definition.GetStyle(this)))
                        {
                            mCurrentStateMachine.AddOneShotScriptEventHandler(0x67, OnPregnancyEvent);
                        }

                        msg += "G";

                        mSteamVfx = VisualEffect.Create(Shower.SteamVfxName);
                        mSteamVfx.ParentTo(Shower, Shower.IsShowerTub ? Slot.FXJoint_2 : Slot.FXJoint_0);
                        mSteamVfx.Start();
                        mCurrentStateMachine.RequestState(null, "BreatheIdle");
                        RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);

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

                        msg += "H";

                        Sims3.Gameplay.Objects.Plumbing.Shower.WaitToLeaveShower(Actor, Shower);

                        // Custom
                        ShowerEx.ApplyPostShowerEffects(Actor, Shower);
                        if (flag)
                        {
                            mSwitchOutfitHelper.Dispose();
                            mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe);
                            mSwitchOutfitHelper.Start();
                            mSwitchOutfitHelper.Wait(false);
                            mSwitchOutfitHelper.ChangeOutfit();
                        }

                        msg += "I";

                        mSwitchOutfitHelper.Dispose();
                        mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GettingOutOfBath);
                        mSwitchOutfitHelper.Start();
                        mSwitchOutfitHelper.AddScriptEventHandler(this);
                        mSwitchOutfitHelper.Wait(false);
                        RemoveMotiveDelta(deltaArray[0x0]);
                        TakeShowerInst.RemoveMotiveDelta(deltaArray[0x1]);
                        RemoveMotiveDelta(deltaArray[0x2]);
                        TakeShowerInst.RemoveMotiveDelta(deltaArray[0x3]);
                        RemoveMotiveDelta(deltaArray[0x4]);

                        if (Actor.SimDescription.IsMermaid)
                        {
                            RemoveMotiveDelta(deltaArray[0x5]);
                        }

                        mCurrentStateMachine.RequestState("y", "Exit Working Y");
                        Target.AutoEnableCensor();

                        msg += "J";
                    }

                    mCurrentStateMachine.RemoveActor(Actor);
                    FinishSocial(socialName, true);
                }

                msg += "K";

                Shower.RemoveFromUseList(Actor);
                mInUseList = false;
                Actor.RouteAway(Sims3.Gameplay.Objects.Plumbing.Shower.kMinDistanceToMoveAwayFromShower, Sims3.Gameplay.Objects.Plumbing.Shower.kMaxDistanceToMoveAwayFromShower, false, GetPriority(), true, true, true, RouteDistancePreference.PreferFurthestFromRouteOrigin);
                if (mSteamVfx != null)
                {
                    mSteamVfx.Stop();
                    mSteamVfx = null;
                }

                msg += "L";

                EndCommodityUpdates(succeeded);
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception exception)
            {
                Common.Exception(Actor, Target, exception);
                return(false);
            }
            finally
            {
                if (TakeShowerInst != null)
                {
                    TakeShowerInst.HavingWooHoo = false;
                }
            }
        }