Esempio n. 1
0
        private static void SwitchToOutfitWithoutSpin(Sim ths, Sim.ClothesChangeReason reason, bool ignoreCurrentCategory)
        {
            if (reason == Sim.ClothesChangeReason.RemovingOuterwear)
            {
                if (ths.OutfitCategoryToUseWhenSpinOutOfOuterwear == OutfitCategories.None)
                {
                    ths.OutfitCategoryToUseWhenSpinOutOfOuterwear = OutfitCategories.Everyday;
                }
            }

            OutfitCategories category;

            ths.GetOutfitForClothingChange(reason, out category);

            if (!ths.SwitchToOutfitTraitTest(reason, ref category))
            {
                return;
            }

            // MC adds swimwear for toddlers
            if (!ths.AcceptableClothingCategoryForAge(category))
            {
                if (ths.SimDescription.Toddler && category != OutfitCategories.Swimwear)
                {
                    return;
                }
            }

            if (ths.SimDescription.OccultManager.DisallowClothesChange())
            {
                return;
            }

            if (ths.BuffManager.DisallowClothesChange(reason, category))
            {
                return;
            }

            if ((!ignoreCurrentCategory && (category == ths.CurrentOutfitCategory)))
            {
                return;
            }

            int num;

            ths.GetCategoryAndIndexToUse(reason, ref category, out num);
            ths.SwitchToOutfitWithoutSpin(category, num);
        }
Esempio n. 2
0
        protected static void OnRoomChanged(Event e)
        {
            Sim obj = e.Actor as Sim;

            if (obj != null)
            {
                if (Woohooer.Settings.NeedsChange(obj))
                {
                    if (Woohooer.Settings.mChangeRoomClothings)
                    {
                        bool needsChange = false;

                        try
                        {
                            if (obj.CurrentOutfitCategory == Sims3.SimIFace.CAS.OutfitCategories.Naked)
                            {
                                needsChange = (SkinnyDipClothingPile.FindClothingPile(obj) == null);
                            }
                        }
                        catch
                        {
                        }

                        if (needsChange)
                        {
                            if (!InteractionsEx.HasInteraction <Shower.TakeShower.Definition>(obj))
                            {
                                Sim.ClothesChangeReason reason = Sim.ClothesChangeReason.GoingToBed;
                                if (obj.IsOutside)
                                {
                                    reason = Sim.ClothesChangeReason.GoingOutside;
                                }
                                else if (Woohooer.Settings.mSwitchToEverydayAfterNakedWoohoo)
                                {
                                    reason = Sim.ClothesChangeReason.LeavingRoom;
                                }

                                SwitchOutfits.SwitchNoSpin(obj, reason);
                            }
                        }
                    }

                    Woohooer.Settings.RemoveChange(obj);
                }
            }
        }
Esempio n. 3
0
 private static void SwitchToOutfitWithoutSpin(Sim ths, Sim.ClothesChangeReason reason)
 {
     SwitchToOutfitWithoutSpin(ths, reason, false);
 }
Esempio n. 4
0
 public static void SwitchNoSpin(Sim ths, Sim.ClothesChangeReason reason)
 {
     SwitchNoSpinTaskA.Perform(ths, reason);
 }
Esempio n. 5
0
 public static void Perform(Sim sim, Sim.ClothesChangeReason reason)
 {
     new SwitchNoSpinTaskA(sim, reason).AddToSimulator();
 }
Esempio n. 6
0
 protected SwitchNoSpinTaskA(Sim sim, Sim.ClothesChangeReason reason)
 {
     mSim    = sim;
     mReason = reason;
 }
Esempio n. 7
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);
            }
        }
Esempio n. 8
0
 protected SwitchNoSpinTaskA(Sim sim, Sim.ClothesChangeReason reason)
 {
     mSim = sim;
     mReason = reason;
 }