Example #1
0
        public static void OnRemoval(OccultGenie ths, SimDescription simDes, bool alterOutfit)
        {
            if (ths.mGenieMagicPoints != null)
            {
                ths.mGenieMagicPoints.RestorePoints();
            }

            OutfitCategories everyday = OutfitCategories.Everyday;
            int index      = 0x0;
            Sim createdSim = simDes.CreatedSim;

            if (createdSim != null)
            {
                createdSim.SetOpacity(1f, 0f);
                createdSim.Motives.RestoreDecays();
                everyday = createdSim.CurrentOutfitCategory;
                index    = createdSim.CurrentOutfitIndex;
            }

            simDes.MotivesDontDecay = false;
            simDes.Marryable        = true;
            simDes.AgingEnabled     = true;

            if (simDes.TraitManager.HasElement(TraitNames.ImmuneToFire))
            {
                simDes.TraitManager.RemoveElement(TraitNames.ImmuneToFire);
            }
            if (simDes.TraitManager.HasElement(TraitNames.GenieHiddenTrait))
            {
                simDes.TraitManager.RemoveElement(TraitNames.GenieHiddenTrait);
            }

            if (alterOutfit)
            {
                simDes.SetSkinToneForAllOutfits(simDes.Age, CASSkinTones.NoSkinTone | CASSkinTones.HumanSkinTone, ths.mOldSkinToneIndex);
                if (createdSim != null)
                {
                    Sim.SwitchOutfitHelper helper = new Sim.SwitchOutfitHelper(createdSim, everyday, index);
                    helper.Start();
                    helper.Wait(false);
                    helper.ChangeOutfit();
                    helper.Dispose();
                }
            }
        }
Example #2
0
        public static void OnRemoval(OccultGenie ths, SimDescription simDes, bool alterOutfit)
        {
            if (ths.mGenieMagicPoints != null)
            {
                ths.mGenieMagicPoints.RestorePoints();
            }

            OutfitCategories everyday = OutfitCategories.Everyday;
            int index = 0x0;
            Sim createdSim = simDes.CreatedSim;
            if (createdSim != null)
            {
                createdSim.SetOpacity(1f, 0f);
                createdSim.Motives.RestoreDecays();
                everyday = createdSim.CurrentOutfitCategory;
                index = createdSim.CurrentOutfitIndex;
            }

            simDes.MotivesDontDecay = false;
            simDes.Marryable = true;
            simDes.AgingEnabled = true;

            if (simDes.TraitManager.HasElement(TraitNames.ImmuneToFire))
            {
                simDes.TraitManager.RemoveElement(TraitNames.ImmuneToFire);
            }
            if (simDes.TraitManager.HasElement(TraitNames.GenieHiddenTrait))
            {
                simDes.TraitManager.RemoveElement(TraitNames.GenieHiddenTrait);
            }

            if (alterOutfit)
            {
                simDes.SetSkinToneForAllOutfits(simDes.Age, CASSkinTones.NoSkinTone | CASSkinTones.HumanSkinTone, ths.mOldSkinToneIndex);
                if (createdSim != null)
                {
                    Sim.SwitchOutfitHelper helper = new Sim.SwitchOutfitHelper(createdSim, everyday, index);
                    helper.Start();
                    helper.Wait(false);
                    helper.ChangeOutfit();
                    helper.Dispose();
                }
            }
        }
Example #3
0
        public override bool Run()
        {
            try
            {
                StandardEntry(false);
                mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToSwim, OutfitCategories.Naked);
                mSwitchOutfitHelper.Start();
                mSwitchOutfitHelper.Wait(false);

                HotTubSeat partSimIsIn = Target.PartComponent.GetPartSimIsIn(Actor) as HotTubSeat;
                mCurrentStateMachine = Actor.Posture.CurrentStateMachine;
                SetParameter("IkSuffix", partSimIsIn.IKSuffix);

                BeginCommodityUpdates();
                AnimateSim("Change To Naked");
                mSwitchOutfitHelper.ChangeOutfit();
                
                // Custom
                HotTubBaseEx.StartSkinnyDipBroadcastersAndSendWishEvents(Target, Actor);

                partSimIsIn.CreateClothingPile();
                Actor.BridgeOrigin = Actor.Posture.Idle();
                EndCommodityUpdates(true);

                Target.PushRelaxInteraction(Actor, Autonomous);
                StandardExit(false, false);
                return true;
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return false;
            }
        }
Example #4
0
        public override bool Run()
        {
            try
            {
                StandardEntry(false);
                mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToSwim, OutfitCategories.Naked);
                mSwitchOutfitHelper.Start();
                mSwitchOutfitHelper.Wait(false);

                HotTubSeat partSimIsIn = Target.PartComponent.GetPartSimIsIn(Actor) as HotTubSeat;
                mCurrentStateMachine = Actor.Posture.CurrentStateMachine;
                SetParameter("IkSuffix", partSimIsIn.IKSuffix);

                BeginCommodityUpdates();
                AnimateSim("Change To Naked");
                mSwitchOutfitHelper.ChangeOutfit();

                // Custom
                HotTubBaseEx.StartSkinnyDipBroadcastersAndSendWishEvents(Target, Actor);

                partSimIsIn.CreateClothingPile();
                Actor.BridgeOrigin = Actor.Posture.Idle();
                EndCommodityUpdates(true);

                Target.PushRelaxInteraction(Actor, Autonomous);
                StandardExit(false, false);
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #5
0
        public static bool Run(RoutineMachine.TeleportBase ths)
        {
            IGameObject obj2;
            if (!ths.Actor.CaregiverCheck())
            {
                return false;
            }
            else if ((ths.Actor.CarryingChildPosture != null) || (ths.Actor.CarryingPetPosture != null))
            {
                return false;
            }

            bool flag = ths.PreTeleport(out obj2, out ths.mTargetLot);
            if (!flag)
            {
                return false;
            }

            ths.OutfitHelper.Start();
            if (ths.Target.Repairable.Broken || ths.Target.Charred)
            {
                if (ths.Actor.RouteToSlotAndCheckInUse(ths.Target, Slot.RoutingSlot_0))
                {
                    ths.StandardEntry();
                    ths.EnterStateMachine("routinemachine_store", "EnterGetReady", "x", "routinemachine");
                    ths.mCurrentStateMachine.SetParameter("tired", SimClock.IsTimeBetweenTimes(RoutineMachine.TeleportBase.kSleepyTimeStart, RoutineMachine.TeleportBase.kSleepyTimeEnd));
                    ths.AnimateSim("GetInMachine");
                    ths.Target.StartPortalTeleportVisualEffects(ths.Actor);
                    ths.AnimateSim("DropThroughPortal");
                    ths.BeginCommodityUpdates();
                    ths.AnimateSim("InsideDreamscape");
                    ths.Target.Repairable.UpdateBreakage(0x64, ths.Actor);
                    if (ths.Actor.SimDescription.IsFrankenstein)
                    {
                        ths.Actor.BuffManager.AddElement(BuffNames.Energized, Origin.FromElectricity);
                    }
                    else if (ths.Actor.BuffManager.HasElement(BuffNames.SingedElectricity) || ths.Actor.TraitManager.HasElement(TraitNames.Unlucky))
                    {
                        ths.Actor.Kill(SimDescription.DeathType.Electrocution, ths.Target);
                    }
                    else
                    {
                        BuffSinged.SingeViaInteraction(ths, Origin.None);
                        ths.Actor.BuffManager.AddElement(BuffNames.SingedElectricity, Origin.None);
                    }

                    FireManager.SimShockedBy(ths.Actor, ths.Target);
                    ths.AnimateSim("ReturnFromDreamscape");
                    ths.AnimateSim("ExitDreamscape");
                    ths.EndCommodityUpdates(false);
                    ths.StandardExit();
                }
                flag = false;
            }

            if (flag && ths.Actor.RouteToSlotAndCheckInUse(ths.Target, Slot.RoutingSlot_0))
            {
                OutfitCategories categories2;
                bool flag2 = false;

                // Custom
                if (Shooless.Settings.GetPrivacy(ths.Target))
                {
                    ths.mSituation = new RoutineMachine.ShowerPrivacySituation(ths);
                    if (!ths.mSituation.Start())
                    {
                        return false;
                    }
                }

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

                bool paramValue = false;
                ths.CancellableByPlayer = false;
                ths.StandardEntry();
                ths.EnterStateMachine("routinemachine_store", "EnterGetReady", "x", "routinemachine");
                ths.mCurrentStateMachine.SetParameter("tired", SimClock.IsTimeBetweenTimes(RoutineMachine.TeleportBase.kSleepyTimeStart, RoutineMachine.TeleportBase.kSleepyTimeEnd));

                if (ths.mSituation != null)
                {
                    ths.mSituation.StateMachine = ths.mCurrentStateMachine;
                }

                ths.AnimateSim("GetInMachine");

                if ((ths.Actor.Motives.HasMotive(CommodityKind.Hunger) && (ths.Actor.Motives.GetValue(CommodityKind.Hunger) < ths.Actor.Motives.GetMax(CommodityKind.Hunger))) && (ths.Actor.Motives.GetValue(CommodityKind.Hunger) < RoutineMachine.TeleportBase.kThresholdHunger))
                {
                    if (ths.Target.Upgradable.CurrentUpgrade == Upgrade.SoupUpSpeakers)
                    {
                        ths.Target.StartSpeakerEffects();
                    }
                    if (!paramValue)
                    {
                        paramValue = true;
                        ths.AnimateSim("InAirIdle");
                    }
                    ths.AnimateSim("SatisfyHunger");
                    ths.Actor.Motives.LerpToFill(ths, CommodityKind.Hunger, RoutineMachine.TeleportBase.kChangeHungerTime);
                    ths.Actor.ClearExitReasons();
                    ths.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(ths.SatisfyHungerDelegate), ths.mCurrentStateMachine);
                    ths.Actor.ClearExitReasons();
                    ths.AnimateSim("InAirIdle");
                }

                if ((ths.Actor.Motives.HasMotive(CommodityKind.Bladder) && (ths.Actor.Motives.GetValue(CommodityKind.Bladder) < ths.Actor.Motives.GetMax(CommodityKind.Bladder))) && (ths.Actor.Motives.GetValue(CommodityKind.Bladder) < RoutineMachine.TeleportBase.kThresholdBladder))
                {
                    if (ths.Target.Upgradable.CurrentUpgrade == Upgrade.SoupUpSpeakers)
                    {
                        ths.Target.StartSpeakerEffects();
                    }
                    if (!paramValue)
                    {
                        paramValue = true;
                        ths.AnimateSim("InAirIdle");
                    }
                    ths.Actor.EnableCensor(Sim.CensorType.LowerBody);
                    ths.AnimateSim("SatisfyBladder");
                    ths.Actor.Motives.LerpToFill(ths, CommodityKind.Bladder, RoutineMachine.TeleportBase.kChangeBladderTime);
                    ths.Actor.ClearExitReasons();
                    ths.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(ths.SatisfyBladderDelegate), ths.mCurrentStateMachine);
                    ths.Actor.ClearExitReasons();
                    ths.AnimateSim("InAirIdle");
                }

                if ((ths.Actor.Motives.HasMotive(CommodityKind.Hygiene) && (ths.Actor.Motives.GetValue(CommodityKind.Hygiene) < ths.Actor.Motives.GetMax(CommodityKind.Hygiene))) && (ths.Actor.Motives.GetValue(CommodityKind.Hygiene) < RoutineMachine.TeleportBase.kThresholdHygiene))
                {
                    if (ths.Target.Upgradable.CurrentUpgrade == Upgrade.SoupUpSpeakers)
                    {
                        ths.Target.StartSpeakerEffects();
                    }

                    if (!paramValue)
                    {
                        paramValue = true;
                        ths.AnimateSim("InAirIdle");
                    }
                    ths.AddSynchronousOneShotScriptEventHandler(0x3e9, ths.ShowerStartEvent);
                    ths.AddSynchronousOneShotScriptEventHandler(0x3ea, ths.ShowerEndEvent);
                    OutfitCategories naked = OutfitCategories.Naked;
                    if (ths.Actor.TraitManager.HasElement(TraitNames.NeverNude))
                    {
                        naked = OutfitCategories.Swimwear;
                    }
                    else
                    {
                        ths.Actor.EnableCensor(Sim.CensorType.FullBody);
                    }

                    using (Sim.SwitchOutfitHelper helper = new Sim.SwitchOutfitHelper(ths.Actor, Sim.ClothesChangeReason.GoingToBathe, naked, false))
                    {
                        helper.Start();
                        helper.Wait(false);
                        helper.ChangeOutfit();
                    }

                    flag2 = true;
                    ths.AnimateSim("SatisfyHygenie");
                    ths.Actor.Motives.LerpToFill(ths, CommodityKind.Hygiene, RoutineMachine.TeleportBase.kChangeHygieneTime);
                    ths.Actor.ClearExitReasons();
                    ths.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(ths.SatisfyHygieneDelegate), ths.mCurrentStateMachine);
                    ths.Actor.ClearExitReasons();
                    ths.AnimateSim("InAirIdle");
                    BuffManager buffManager = ths.Actor.BuffManager;
                    buffManager.RemoveElement(BuffNames.Singed);
                    buffManager.RemoveElement(BuffNames.SingedElectricity);
                    buffManager.RemoveElement(BuffNames.GarlicBreath);
                    if (ths.Actor.SimDescription.IsMummy)
                    {
                        buffManager.AddElement(BuffNames.Soaked, Origin.FromShower);
                    }
                    if (ths.Actor.HasTrait(TraitNames.Hydrophobic))
                    {
                        ths.Actor.PlayReaction(ReactionTypes.Cry, ths.Target, ReactionSpeed.AfterInteraction);
                    }
                }

                if (ths.Actor.GetOutfitForClothingChange(ths.NewClothesStyle, out categories2) || flag2)
                {
                    ths.mCurrentStateMachine.SetParameter("inAirIdle", paramValue);
                    ths.AnimateSim("PrepareToChangeClothes");
                    using (Sim.SwitchOutfitHelper helper2 = new Sim.SwitchOutfitHelper(ths.Actor, Sim.ClothesChangeReason.Force, categories2))
                    {
                        helper2.Start();
                        helper2.Wait(false);
                        helper2.ChangeOutfit();
                    }
                }

                ths.Actor.AutoEnableCensor();
                ths.AddSynchronousOneShotScriptEventHandler(0x64, ths.TeleportOutEvent);
                ths.AnimateSim("DropThroughPortal");
                ths.Target.StopSpeakerEffects();
                if (ths.mSituation != null)
                {
                    ths.mSituation.Exit();
                    ths.mSituation = null;
                }

                if (ths.Actor.Motives.GetValue(CommodityKind.Energy) < RoutineMachine.TeleportBase.kMinEnergyToTeleport)
                {
                    ths.Target.StartDreamscapeEffects();
                    ths.Target.Repairable.UpdateBreakage(0x64, ths.Actor);
                    ths.RunDreamscape();
                    ths.Target.StopDreamscapeEffects();
                }

                flag = ths.DoTeleport(obj2);
                ths.AnimateSim("ExitGetReady");
                ths.EnterStateMachine("routinemachine_store", "EnterBeTeleported", "x", "routinemachine");
                ths.AddSynchronousOneShotScriptEventHandler(0x64, ths.TeleportBackEvent);
                ths.AnimateSim("BeTeleported");
                ths.AnimateSim("ExitBeTeleported");
                ths.StandardExit();
            }

            ths.Target.StopPortalReturnVisualEffects();
            if (ths.mSituation != null)
            {
                ths.mSituation.Exit();
            }
            return flag;
        }
Example #6
0
 public override bool Run()
 {
     try
     {
         if (!Actor.RouteToSlotAndCheckInUse(Target, StylingStation.kPlatformRoutingSlot))
         {
             return(false);
         }
         StandardEntry();
         Styling.PreMakeover(Actor, Actor);
         EnterStateMachine("StylingStation", "Enter", "x", "stylistStation");
         AddSynchronousOneShotScriptEventHandler(0x384, new SacsEventHandler(SnapSimToPlatform));
         AddSynchronousOneShotScriptEventHandler(0x385, new SacsEventHandler(SnapSimToGround));
         AnimateSim("Get On Platform");
         if (Actor.HasExitReason())
         {
             AnimateSim("Get Off Platform");
             AnimateSim("Exit");
             StandardExit();
             return(false);
         }
         BeginCommodityUpdates();
         AnimateSim("Customer Alone Loop");
         float duration  = Actor.IsNPC ? StylingStation.kNPCMakeoverDurationInMinutes : StylingStation.kMakeoverDurationInMinutes;
         bool  succeeded = DoTimedLoop(duration);
         if (succeeded)
         {
             Styling.MakeoverOutcome success = Styling.MakeoverOutcome.Success;
             bool isSelectable = Actor.IsSelectable;
             if (!isSelectable)
             {
                 Sim.SwitchOutfitHelper switchOutfitHelper = null;
                 Styling.LoadMakeoverOutfitForClothesSpin(Actor, false, Autonomous, ref switchOutfitHelper);
                 mSwitchOutfitHelper = switchOutfitHelper;
             }
             Animate("x", "Gussy Anims Done");
             if (!isSelectable && (mSwitchOutfitHelper != null))
             {
                 mSwitchOutfitHelper.Wait(true);
                 mSwitchOutfitHelper.AddScriptEventHandler(this);
             }
             if (isSelectable)
             {
                 bool tookSemaphore = mTookSemaphore;
                 isSelectable   = GetMakeoverEx.DisplayCAS(Actor, null, ref tookSemaphore, false);
                 mTookSemaphore = tookSemaphore;
             }
             SkillLevel expert = SkillLevel.expert;
             SetParameter("doClothesSpin", !isSelectable);
             SetParameter("customerReactionType", expert);
             Animate("x", "Customer Reaction");
             ReleaseSemaphore();
             Styling.PostMakeover(Actor, Actor, success, false, expert, isSelectable, isSelectable, null);
         }
         if (succeeded)
         {
             Actor.SkillManager.AddElement(SkillNames.Styling);
         }
         EndCommodityUpdates(succeeded);
         AnimateSim("Get Off Platform");
         AnimateSim("Exit");
         StandardExit();
         return(succeeded);
     }
     catch (ResetException)
     {
         throw;
     }
     catch (Exception e)
     {
         Common.Exception(Actor, Target, e);
         return(false);
     }
 }
Example #7
0
        public override bool Run()
        {
            try
            {
                Definition interactionDefinition = InteractionDefinition as Definition;
                bool isSkinnyDipping = interactionDefinition.IsSkinnyDipping || (Actor.CurrentOutfitCategory == OutfitCategories.SkinnyDippingTowel);

                pickSeat();
                if (isSkinnyDipping)
                {
                    mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToSwim, OutfitCategories.Naked, false);
                }
                else
                {
                    mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToSwim);
                }

                mSwitchOutfitHelper.Start();
                Slot none = Slot.None;
                if (!RouteToHottub(out none))
                {
                    return false;
                }

                HotTubSeat part = Target.PartComponent.GetPart(none) as HotTubSeat;
                if (part.InUse && !MoveSimToDifferentSeat(part))
                {
                    return false;
                }

                if (Target.Repairable.Broken)
                {
                    return false;
                }

                StandardEntry();
                BeginCommodityUpdates();
                if (Actor.HasTrait(TraitNames.Hydrophobic))
                {
                    Actor.PlayReaction(ReactionTypes.WhyMe, Target, ReactionSpeed.ImmediateWithoutOverlay);
                }

                // Custom
                bool succeeded = HotTubBaseEx.SitDown(Target, Actor, none, part, mSwitchOutfitHelper, isSkinnyDipping, InvitedBy, Autonomous);
                if (succeeded)
                {
                    if (Actor.HasExitReason(ExitReason.CancelledByPosture))
                    {
                        InteractionInstance cancelTransition = Actor.Posture.GetCancelTransition();
                        Actor.InteractionQueue.PushAsContinuation(cancelTransition, true);
                    }
                    else
                    {
                        if ((!Target.Repairable.Broken && !Target.Repairable.UpdateBreakage(Actor)) && Actor.HasTrait(TraitNames.Hydrophobic))
                        {
                            Actor.BuffManager.AddElementPaused(BuffNames.Hydrophobic, Origin.FromHotTub);
                        }
                        Target.PushRelaxInteraction(Actor, Autonomous);
                    }
                }

                StandardExit(!succeeded, !succeeded);
                EndCommodityUpdates(succeeded);

                if (mIsMaster)
                {
                    HotTubGetIn linked = LinkedInteractionInstance as HotTubGetIn;
                    if (linked != null)
                    {
                        Sim linkedActor = linked.Actor;

                        while (!Cancelled)
                        {
                            if (!linkedActor.InteractionQueue.HasInteraction(linked)) break;

                            if (linked.mCompleted) break;

                            SpeedTrap.Sleep(10);
                        }
                    }
                }

                return true;
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return false;
            }
        }
Example #8
0
 public override bool Run()
 {
     try{
         if (!Target.SimLine.WaitForTurn(this, SimQueue.WaitBehavior.DefaultEvict,
                                         ~(ExitReason.Replan |
                                           ExitReason.MidRoutePushRequested |
                                           ExitReason.ObjectStateChanged |
                                           ExitReason.PlayIdle |
                                           ExitReason.MaxSkillPointsReached), Shower.kTimeToWaitToEvict))
         {
             return(false);
         }
         try{
             mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe);
         }catch {
             return(false);
         }
         mSwitchOutfitHelper.Start();
         if (Actor.HasTrait(TraitNames.Hydrophobic))
         {
             Actor.PlayReaction(ReactionTypes.WhyMe, Target as GameObject, ReactionSpeed.ImmediateWithoutOverlay);
         }
         if (Actor.HasTrait(TraitNames.Daredevil))
         {
             TraitTipsManager.ShowTraitTip(0xb82d0015b9294260L, Actor, TraitTipsManager.TraitTipCounterIndex.Daredevil, TraitTipsManager.kDaredevilCountOfShowersTaken);
         }
         if (!Actor.RouteToSlotAndCheckInUse(Target, Slot.RoutingSlot_0))
         {
             return(false);
         }
         //    mSituation=new Shower.ShowerPrivacySituation(this);
         //if(!mSituation.Start()){
         //        return(false);
         //}
         StandardEntry();
         if (!Actor.RouteToSlot(Target, Slot.RoutingSlot_0))
         {
             if (mSituation != null)
             {
                 mSituation.Exit();
             }
             StandardExit();
             return(false);
         }
         if (Autonomous)
         {
             mPriority = new InteractionPriority(InteractionPriorityLevel.UserDirected);
         }
         mSwitchOutfitHelper.Wait(true);
         bool daredevilPerforming =
             Actor.DaredevilPerforming;
         bool flag2 = Actor.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed;
         EnterStateMachine("Shower", "Enter", "x");
         SetActor("Shower", Target);
         if (mSituation != null)
         {
             mSituation.StateMachine = mCurrentStateMachine;
         }
         SetParameter("IsShowerTub", Target.IsShowerTub);
         SetParameter("SimShouldCloseDoor", true);
         SetParameter("SimShouldClothesChange", ((!daredevilPerforming && !flag2) && !Actor.OccultManager.DisallowClothesChange()) && !Actor.BuffManager.DisallowClothesChange());
         bool paramValue = false;
         if ((Target.BoobyTrapComponent != null) && Target.BoobyTrapComponent.CanTriggerTrap(Actor.SimDescription))
         {
             paramValue = !Actor.OccultManager.DisallowClothesChange() && !Actor.BuffManager.DisallowClothesChange();
         }
         SimDescription description = ((Target.BoobyTrapComponent != null) && (Target.BoobyTrapComponent.TrapSetter != 0L)) ? SimDescription.Find(Target.BoobyTrapComponent.TrapSetter) : null;
         if (((description != null) && description.IsFairy) && Actor.BuffManager.HasElement(BuffNames.TrickedByAFairy))
         {
             paramValue = false;
         }
         SetParameter("isBoobyTrapped", paramValue);
         mSwitchOutfitHelper.AddScriptEventHandler(this);
         AddOneShotScriptEventHandler(0x3e9, EventCallbackStartShoweringSound);
         if (Actor.HasTrait(TraitNames.Virtuoso) || RandomUtil.RandomChance((float)Target.TuningShower.ChanceOfSinging))
         {
             AddOneShotScriptEventHandler(0xc8, EventCallbackStartSinging);
         }
         PetStartleBehavior.CheckForStartle(Target as GameObject, StartleType.ShowerOn);
         AnimateSim("Loop Shower");
         Actor.BuffManager.AddElement(BuffNames.SavingWater, Origin.FromShower, ProductVersion.EP2, TraitNames.EnvironmentallyConscious);
         mShowerStage.ResetCompletionTime(GetShowerTime());
         StartStages();
         if (Actor.HasTrait(TraitNames.EnvironmentallyConscious))
         {
             BeginCommodityUpdate(CommodityKind.Hygiene, Shower.kEnvironmentallyConsciousShowerSpeedMultiplier);
         }
         if (Actor.SimDescription.IsPlantSim)
         {
             ModifyCommodityUpdate(CommodityKind.Hygiene, Shower.kPlantSimHygieneModifier);
         }
         BeginCommodityUpdates();
         if (paramValue)
         {
             ApplyBoobyTrapOutfit();
             if ((description != null) && description.IsFairy)
             {
                 Actor.BuffManager.AddElement(BuffNames.TrickedByAFairy, Origin.FromFairy);
             }
         }
         bool succeeded = (false);
         try{
             try{
                 Target.SimInShower = Actor;
                 succeeded          = DoLoop(~(
                                                 ExitReason.Replan |
                                                 ExitReason.MidRoutePushRequested |
                                                 ExitReason.ObjectStateChanged |
                                                 ExitReason.PlayIdle |
                                                 ExitReason.MaxSkillPointsReached), DuringShower, null);
                 if (HavingWooHoo && Actor.HasExitReason(ExitReason.StageComplete))
                 {
                     succeeded = DoLoop(~(
                                            ExitReason.Replan |
                                            ExitReason.MidRoutePushRequested |
                                            ExitReason.ObjectStateChanged |
                                            ExitReason.PlayIdle |
                                            ExitReason.MaxSkillPointsReached |
                                            ExitReason.StageComplete), DuringShower, null);
                 }
             }finally{
                 Target.SimInShower = null;
             }
             while (HavingWooHoo)
             {
                 SpeedTrap.Sleep(10);
             }
         }finally{
             EndCommodityUpdates(succeeded);
         }
         Shower.WaitToLeaveShower(Actor, Target);
         if (succeeded)
         {
             Shower.ApplyPostShowerEffects(Actor, Target);
         }
         if (paramValue)
         {
             SetParameter("isBoobyTrapped", false);
             AddOneShotScriptEventHandler(0xc9, EventCallbackStopSinging);
             AddOneShotScriptEventHandler(0x3ea, EventCallbackStopShoweringSound);
             if ((description != null) && description.IsFairy)
             {
                 AnimateSim("TriggerFairyTrap");
             }
             else
             {
                 AnimateSim("Booby Trap Reaction");
             }
             AddOneShotScriptEventHandler(0x3e9, EventCallbackStartShoweringSound);
             AnimateSim("Loop Shower");
             RemoveBoobyTrapOutfit();
             SpeedTrap.Sleep(60);
         }
         try{
             if (flag2 && succeeded)
             {
                 mSwitchOutfitHelper.Dispose();
                 try{
                     mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe);
                     mSwitchOutfitHelper.Start();
                     mSwitchOutfitHelper.Wait(false);
                     mSwitchOutfitHelper.ChangeOutfit();
                 }catch {}
             }
             bool flag5 = (false);
             if ((flag2 && succeeded) || (!flag2 && !daredevilPerforming))
             {
                 SetParameter("SimShouldClothesChange", !Actor.OccultManager.DisallowClothesChange());
                 mSwitchOutfitHelper.Dispose();
                 try{
                     mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, GetOutfitReason(Actor));
                     mSwitchOutfitHelper.Start();
                     mSwitchOutfitHelper.AddScriptEventHandler(this);
                     mSwitchOutfitHelper.Wait(false);
                 }catch {}
                 flag5 = (true);
             }
             Target.Cleanable.DirtyInc(Actor);
             AddOneShotScriptEventHandler(0xc9, EventCallbackStopSinging);
             AddOneShotScriptEventHandler(0x3ea, EventCallbackStopShoweringSound);
             if (flag5 && InventingSkill.IsBeingDetonated(Target as GameObject))
             {
                 SetParameter("SimShouldClothesChange", false);
                 mSwitchOutfitHelper.Abort();
                 mSwitchOutfitHelper.Dispose();
             }
             if (Target.Repairable.UpdateBreakage(Actor))
             {
                 Target.StartBrokenFXInAnim(mCurrentStateMachine);
                 AnimateSim("Exit Broken");
             }
             else
             {
                 AnimateSim("Exit Working");
             }
             if ((Actor.SimDescription.IsMummy || Actor.DaredevilPerforming) || (Actor.TraitManager.HasElement(TraitNames.Slob) && RandomUtil.RandomChance01(TraitTuning.SlobTraitChanceToLeavePuddle)))
             {
                 PuddleManager.AddPuddle(Actor.Position);
             }
             if (succeeded)
             {
                 Actor.BuffManager.RemoveElement(BuffNames.GotFleasHuman);
             }
         }finally{
             StandardExit();
         }
         return(succeeded);
     }catch (ResetException exception) {
         Alive.WriteLog(exception.Message + "\n\n" +
                        exception.StackTrace + "\n\n" +
                        exception.Source);
         return(false);
     }catch (Exception exception) {
         Alive.WriteLog(exception.Message + "\n\n" +
                        exception.StackTrace + "\n\n" +
                        exception.Source);
         return(false);
     }
 }
Example #9
0
        public override bool Run()
        {
            try
            {
                try
                {
                    mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe);
                }
                catch
                {
                    return false;
                }

                mSwitchOutfitHelper.Start();
                if (!Target.RouteToSink(this))
                {
                    return false;
                }

                if (Shooless.Settings.GetPrivacy(Target))
                {
                    mSituation = new Sink.SpongeBathPrivacySituation(this);
                    if (!mSituation.Start())
                    {
                        return false;
                    }
                }

                Matrix44 transform = Actor.Transform;
                if (!Actor.RouteToMatrix(ref transform))
                {
                    if (mSituation != null)
                    {
                        mSituation.Exit();
                    }
                    return false;
                }
                StandardEntry();
                mSwitchOutfitHelper.Wait(true);
                bool flag = Actor.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed;
                Target.mSimUsingSink = Actor;
                mCurrentStateMachine = Target.GetStateMachine(Actor, "Enter");
                if (mSituation != null)
                {
                    mSituation.StateMachine = mCurrentStateMachine;
                }
                SetParameter("SimShouldClothesChange", !flag && !Actor.OccultManager.DisallowClothesChange());
                mSwitchOutfitHelper.AddScriptEventHandler(this);
                AddOneShotScriptEventHandler(0x3e9, new SacsEventHandler(EventCallbackStartWaterSound));
                bool paramValue = (Target.BoobyTrapComponent != null) ? Target.BoobyTrapComponent.CanTriggerTrap(Actor.SimDescription) : false;
                mCurrentStateMachine.SetParameter("isBoobyTrapped", paramValue);
                AnimateSim("Loop SpongeBath");
                StartStages();
                Target.StartDisgustEffect();
                BeginCommodityUpdates();

                bool succeeded = false;
                if (paramValue)
                {
                    Target.TriggerTrap(Actor);
                }
                else
                {
                    try
                    {
                        Sink.CheckToAddChillyBuff(Actor, Target);
                        succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), LoopDel, null);
                        Actor.BuffManager.UnpauseBuff(BuffNames.Chilly);
                    }
                    finally
                    {
                        EndCommodityUpdates(succeeded);
                    }

                    if (succeeded)
                    {
                        Actor.BuffManager.RemoveElement(BuffNames.Singed);
                        Actor.BuffManager.RemoveElement(BuffNames.SingedElectricity);
                        Actor.BuffManager.RemoveElement(BuffNames.GotFleasHuman);
                    }
                    if (!flag || (flag && succeeded))
                    {
                        SetParameter("SimShouldClothesChange", !Actor.OccultManager.DisallowClothesChange());
                        mSwitchOutfitHelper.Dispose();

                        try
                        {
                            mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GettingOutOfBath);
                            mSwitchOutfitHelper.Start();
                            mSwitchOutfitHelper.AddScriptEventHandler(this);
                            mSwitchOutfitHelper.Wait(false);
                        }
                        catch
                        { }
                    }
                }

                AddOneShotScriptEventHandler(0x3ea, new SacsEventHandler(EventCallbackStopWaterSound));
                Target.UpdateDirtyBreakAndPickExitState(mCurrentStateMachine, Actor);
                Target.StopDisgustEffect();
                Target.mSimUsingSink = null;
                TraitFunctions.CheckForNeuroticAnxiety(Actor, TraitFunctions.NeuroticTraitAnxietyType.Sink);
                StandardExit();
                return succeeded;
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return false;
            }
        }
Example #10
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);
            }
        }
Example #11
0
        public override bool Run()
        {
            try
            {
                Definition interactionDefinition = InteractionDefinition as Definition;
                bool       isSkinnyDipping       = interactionDefinition.IsSkinnyDipping || (Actor.CurrentOutfitCategory == OutfitCategories.SkinnyDippingTowel);

                pickSeat();
                if (isSkinnyDipping)
                {
                    mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToSwim, OutfitCategories.Naked, false);
                }
                else
                {
                    mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToSwim);
                }

                mSwitchOutfitHelper.Start();
                Slot none = Slot.None;
                if (!RouteToHottub(out none))
                {
                    return(false);
                }

                HotTubSeat part = Target.PartComponent.GetPart(none) as HotTubSeat;
                if (part.InUse && !MoveSimToDifferentSeat(part))
                {
                    return(false);
                }

                if (Target.Repairable.Broken)
                {
                    return(false);
                }

                StandardEntry();
                BeginCommodityUpdates();
                if (Actor.HasTrait(TraitNames.Hydrophobic))
                {
                    Actor.PlayReaction(ReactionTypes.WhyMe, Target, ReactionSpeed.ImmediateWithoutOverlay);
                }

                // Custom
                bool succeeded = HotTubBaseEx.SitDown(Target, Actor, none, part, mSwitchOutfitHelper, isSkinnyDipping, InvitedBy, Autonomous);
                if (succeeded)
                {
                    if (Actor.HasExitReason(ExitReason.CancelledByPosture))
                    {
                        InteractionInstance cancelTransition = Actor.Posture.GetCancelTransition();
                        Actor.InteractionQueue.PushAsContinuation(cancelTransition, true);
                    }
                    else
                    {
                        if ((!Target.Repairable.Broken && !Target.Repairable.UpdateBreakage(Actor)) && Actor.HasTrait(TraitNames.Hydrophobic))
                        {
                            Actor.BuffManager.AddElementPaused(BuffNames.Hydrophobic, Origin.FromHotTub);
                        }
                        Target.PushRelaxInteraction(Actor, Autonomous);
                    }
                }

                StandardExit(!succeeded, !succeeded);
                EndCommodityUpdates(succeeded);

                if (mIsMaster)
                {
                    HotTubGetIn linked = LinkedInteractionInstance as HotTubGetIn;
                    if (linked != null)
                    {
                        Sim linkedActor = linked.Actor;

                        while (!Cancelled)
                        {
                            if (!linkedActor.InteractionQueue.HasInteraction(linked))
                            {
                                break;
                            }

                            if (linked.mCompleted)
                            {
                                break;
                            }

                            SpeedTrap.Sleep(10);
                        }
                    }
                }

                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #12
0
        /*
         * public void AddInteraction(Common.InteractionInjectorList interactions)
         * {
         *  interactions.Add<StylingStation, StylingStation.GetMakeover.Definition>(Singleton);
         * }
         */

        public override bool Run()
        {
            try
            {
                bool succeeded = false;
                if (Styler == null)
                {
                    return(false);
                }
                else if ((Actor.LotCurrent != Styler.LotCurrent) && !RouteActorToTargetLot())
                {
                    return(false);
                }
                else if (ShouldPushOtherHalf && !PushOtherHalf(StylingStation.GiveMakeover.Singleton, Actor, Styler, null))
                {
                    return(false);
                }
                else if (!Actor.RouteToSlot(Target, StylingStation.kPlatformRoutingSlot))
                {
                    return(false);
                }
                else if (!Styling.CanSimReceiveMakeover(Actor, Styler, Autonomous))
                {
                    return(false);
                }
                else if (Target.UseCount > 0x1)
                {
                    return(false);
                }
                else if (Target.UseCount == 0x1)
                {
                    if (!Target.IsActorUsingMe(Styler))
                    {
                        return(false);
                    }
                    if (Styler.InteractionQueue.GetHeadInteraction() != LinkedInteractionInstance)
                    {
                        return(false);
                    }
                }

                StandardEntry();
                Styling.PreMakeover(Actor, Styler);
                AddSynchronousOneShotScriptEventHandler(0x384, SnapSimToPlatform);
                AddSynchronousOneShotScriptEventHandler(0x385, SnapSimToGround);
                Animate("x", "Get On Platform");
                Actor.LoopIdle();
                if (!StartSync(true))
                {
                    Animate("x", "Get Off Platform");
                    Animate("x", "Exit");
                    StandardExit(true, false);
                    return(false);
                }
                BeginCommodityUpdates();
                AddPersistentScriptEventHandler(0x7a6a, DisplayThoughtBalloon);
                AddPersistentScriptEventHandler(0x7a69, DisplayThoughtBalloon);
                bool flag2 = false;
                int  num   = 0x0;
                do
                {
                    num++;
                    flag2 = false;
                    AnimateJoinSims("Customer and Stylist Loop");
                    float duration = (Styler.IsNPC && Actor.IsNPC) ? StylingStation.kNPCMakeoverDurationInMinutes : StylingStation.kMakeoverDurationInMinutes;
                    succeeded = DoTimedLoop(duration);
                    AnimateNoYield("y", "Stylist Idle");
                    StylingStation.GiveMakeover linkedInteractionInstance = LinkedInteractionInstance as StylingStation.GiveMakeover;
                    linkedInteractionInstance.DoStylistIdle = true;
                    if (succeeded)
                    {
                        bool enteringCAS = linkedInteractionInstance.SimInCAS != null;
                        Styling.MakeoverOutcome makeoverOutcome = Styling.GetMakeoverOutcome(Actor, Styler, enteringCAS);
                        bool epicMakeoverFailure = makeoverOutcome == Styling.MakeoverOutcome.EpicFailure;
                        if (!enteringCAS)
                        {
                            Sim.SwitchOutfitHelper switchOutfitHelper = null;
                            Styling.LoadMakeoverOutfitForClothesSpin(Actor, epicMakeoverFailure, Autonomous, ref switchOutfitHelper);
                            mSwitchOutfitHelper = switchOutfitHelper;
                        }
                        else if (epicMakeoverFailure)
                        {
                            Styling.LoadMakeoverEpicFailureOutfitForCasOverride(Actor);
                        }
                        Animate("x", "Gussy Anims Done");
                        if (!enteringCAS && (mSwitchOutfitHelper != null))
                        {
                            mSwitchOutfitHelper.Wait(true);
                            mSwitchOutfitHelper.AddScriptEventHandler(this);
                        }

                        if (enteringCAS)
                        {
                            bool tookSemaphore = mTookSemaphore;
                            enteringCAS    = DisplayCAS(linkedInteractionInstance.SimInCAS, Styler, ref tookSemaphore, epicMakeoverFailure);
                            mTookSemaphore = tookSemaphore;
                            ReleaseSemaphore();
                            succeeded = CASChangeReporter.Instance.GetPropertyChanged(CASChangeReporter.ChangeFlags.Any);
                        }

                        if (succeeded)
                        {
                            float[]    reactionWeightsBonus = Target.UpgradableComponent.LookGoodMirrors ? StylingStation.kUpgradeReactionWeightsBonus : null;
                            SkillLevel paramValue           = Styling.GetCustomerReactionType(Actor, Styler, makeoverOutcome, num >= 0x2, reactionWeightsBonus);
                            SetParameter("doClothesSpin", !enteringCAS);
                            SetParameter("customerReactionType", paramValue);
                            Animate("x", "Customer Reaction");
                            Styling.PostMakeover(Actor, Styler, makeoverOutcome, false, paramValue, enteringCAS, enteringCAS, OnMakeoverCompleted);
                            SkillLevel stylerReactionType = Styling.GetStylerReactionType(paramValue);
                            SetParameter("stylistReactionType", stylerReactionType);
                            AnimateNoYield("y", "Stylist Reaction");
                            (LinkedInteractionInstance as StylingStation.GiveMakeover).DoStylistIdle = true;
                            Actor.LoopIdle();
                            if (((Actor.IsNPC && Styler.IsNPC) && (paramValue == SkillLevel.poor)) && ((num <= 0x1) && Actor.HasNoExitReason()))
                            {
                                flag2 = true;
                            }
                        }
                        else
                        {
                            (LinkedInteractionInstance as StylingStation.GiveMakeover).MakeoverCancelled = true;
                        }
                    }
                }while (flag2);
                Animate("x", "Get Off Platform");
                AnimateNoYield("y", "Exit Stylist");
                Animate("x", "Exit");
                FinishLinkedInteraction(true);
                EndCommodityUpdates(succeeded);
                StandardExit(true, false);
                WaitForSyncComplete();
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #13
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;
                }
            }
        }
Example #14
0
        public override bool Run()
        {
            try
            {
                try
                {
                    mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GoingToBathe);
                }
                catch
                {
                    return(false);
                }

                mSwitchOutfitHelper.Start();
                if (!Target.RouteToSink(this))
                {
                    return(false);
                }

                if (Shooless.Settings.GetPrivacy(Target))
                {
                    mSituation = new Sink.SpongeBathPrivacySituation(this);
                    if (!mSituation.Start())
                    {
                        return(false);
                    }
                }

                Matrix44 transform = Actor.Transform;
                if (!Actor.RouteToMatrix(ref transform))
                {
                    if (mSituation != null)
                    {
                        mSituation.Exit();
                    }
                    return(false);
                }
                StandardEntry();
                mSwitchOutfitHelper.Wait(true);
                bool flag = Actor.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed;
                Target.mSimUsingSink = Actor;
                mCurrentStateMachine = Target.GetStateMachine(Actor, "Enter");
                if (mSituation != null)
                {
                    mSituation.StateMachine = mCurrentStateMachine;
                }
                SetParameter("SimShouldClothesChange", !flag && !Actor.OccultManager.DisallowClothesChange());
                mSwitchOutfitHelper.AddScriptEventHandler(this);
                AddOneShotScriptEventHandler(0x3e9, new SacsEventHandler(EventCallbackStartWaterSound));
                bool paramValue = (Target.BoobyTrapComponent != null) ? Target.BoobyTrapComponent.CanTriggerTrap(Actor.SimDescription) : false;
                mCurrentStateMachine.SetParameter("isBoobyTrapped", paramValue);
                AnimateSim("Loop SpongeBath");
                StartStages();
                Target.StartDisgustEffect();
                BeginCommodityUpdates();

                bool succeeded = false;
                if (paramValue)
                {
                    Target.TriggerTrap(Actor);
                }
                else
                {
                    try
                    {
                        Sink.CheckToAddChillyBuff(Actor, Target);
                        succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), LoopDel, null);
                        Actor.BuffManager.UnpauseBuff(BuffNames.Chilly);
                    }
                    finally
                    {
                        EndCommodityUpdates(succeeded);
                    }

                    if (succeeded)
                    {
                        Actor.BuffManager.RemoveElement(BuffNames.Singed);
                        Actor.BuffManager.RemoveElement(BuffNames.SingedElectricity);
                        Actor.BuffManager.RemoveElement(BuffNames.GotFleasHuman);
                    }
                    if (!flag || (flag && succeeded))
                    {
                        SetParameter("SimShouldClothesChange", !Actor.OccultManager.DisallowClothesChange());
                        mSwitchOutfitHelper.Dispose();

                        try
                        {
                            mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, Sim.ClothesChangeReason.GettingOutOfBath);
                            mSwitchOutfitHelper.Start();
                            mSwitchOutfitHelper.AddScriptEventHandler(this);
                            mSwitchOutfitHelper.Wait(false);
                        }
                        catch
                        { }
                    }
                }

                AddOneShotScriptEventHandler(0x3ea, new SacsEventHandler(EventCallbackStopWaterSound));
                Target.UpdateDirtyBreakAndPickExitState(mCurrentStateMachine, Actor);
                Target.StopDisgustEffect();
                Target.mSimUsingSink = null;
                TraitFunctions.CheckForNeuroticAnxiety(Actor, TraitFunctions.NeuroticTraitAnxietyType.Sink);
                StandardExit();
                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Example #15
0
        public static bool Run(RoutineMachine.TeleportBase ths)
        {
            IGameObject obj2;

            if (!ths.Actor.CaregiverCheck())
            {
                return(false);
            }
            else if ((ths.Actor.CarryingChildPosture != null) || (ths.Actor.CarryingPetPosture != null))
            {
                return(false);
            }

            bool flag = ths.PreTeleport(out obj2, out ths.mTargetLot);

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

            ths.OutfitHelper.Start();
            if (ths.Target.Repairable.Broken || ths.Target.Charred)
            {
                if (ths.Actor.RouteToSlotAndCheckInUse(ths.Target, Slot.RoutingSlot_0))
                {
                    ths.StandardEntry();
                    ths.EnterStateMachine("routinemachine_store", "EnterGetReady", "x", "routinemachine");
                    ths.mCurrentStateMachine.SetParameter("tired", SimClock.IsTimeBetweenTimes(RoutineMachine.TeleportBase.kSleepyTimeStart, RoutineMachine.TeleportBase.kSleepyTimeEnd));
                    ths.AnimateSim("GetInMachine");
                    ths.Target.StartPortalTeleportVisualEffects(ths.Actor);
                    ths.AnimateSim("DropThroughPortal");
                    ths.BeginCommodityUpdates();
                    ths.AnimateSim("InsideDreamscape");
                    ths.Target.Repairable.UpdateBreakage(0x64, ths.Actor);
                    if (ths.Actor.SimDescription.IsFrankenstein)
                    {
                        ths.Actor.BuffManager.AddElement(BuffNames.Energized, Origin.FromElectricity);
                    }
                    else if (ths.Actor.BuffManager.HasElement(BuffNames.SingedElectricity) || ths.Actor.TraitManager.HasElement(TraitNames.Unlucky))
                    {
                        ths.Actor.Kill(SimDescription.DeathType.Electrocution, ths.Target);
                    }
                    else
                    {
                        BuffSinged.SingeViaInteraction(ths, Origin.None);
                        ths.Actor.BuffManager.AddElement(BuffNames.SingedElectricity, Origin.None);
                    }

                    FireManager.SimShockedBy(ths.Actor, ths.Target);
                    ths.AnimateSim("ReturnFromDreamscape");
                    ths.AnimateSim("ExitDreamscape");
                    ths.EndCommodityUpdates(false);
                    ths.StandardExit();
                }
                flag = false;
            }

            if (flag && ths.Actor.RouteToSlotAndCheckInUse(ths.Target, Slot.RoutingSlot_0))
            {
                OutfitCategories categories2;
                bool             flag2 = false;

                // Custom
                if (Shooless.Settings.GetPrivacy(ths.Target))
                {
                    ths.mSituation = new RoutineMachine.ShowerPrivacySituation(ths);
                    if (!ths.mSituation.Start())
                    {
                        return(false);
                    }
                }

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

                bool paramValue = false;
                ths.CancellableByPlayer = false;
                ths.StandardEntry();
                ths.EnterStateMachine("routinemachine_store", "EnterGetReady", "x", "routinemachine");
                ths.mCurrentStateMachine.SetParameter("tired", SimClock.IsTimeBetweenTimes(RoutineMachine.TeleportBase.kSleepyTimeStart, RoutineMachine.TeleportBase.kSleepyTimeEnd));

                if (ths.mSituation != null)
                {
                    ths.mSituation.StateMachine = ths.mCurrentStateMachine;
                }

                ths.AnimateSim("GetInMachine");

                if ((ths.Actor.Motives.HasMotive(CommodityKind.Hunger) && (ths.Actor.Motives.GetValue(CommodityKind.Hunger) < ths.Actor.Motives.GetMax(CommodityKind.Hunger))) && (ths.Actor.Motives.GetValue(CommodityKind.Hunger) < RoutineMachine.TeleportBase.kThresholdHunger))
                {
                    if (ths.Target.Upgradable.CurrentUpgrade == Upgrade.SoupUpSpeakers)
                    {
                        ths.Target.StartSpeakerEffects();
                    }
                    if (!paramValue)
                    {
                        paramValue = true;
                        ths.AnimateSim("InAirIdle");
                    }
                    ths.AnimateSim("SatisfyHunger");
                    ths.Actor.Motives.LerpToFill(ths, CommodityKind.Hunger, RoutineMachine.TeleportBase.kChangeHungerTime);
                    ths.Actor.ClearExitReasons();
                    ths.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(ths.SatisfyHungerDelegate), ths.mCurrentStateMachine);
                    ths.Actor.ClearExitReasons();
                    ths.AnimateSim("InAirIdle");
                }

                if ((ths.Actor.Motives.HasMotive(CommodityKind.Bladder) && (ths.Actor.Motives.GetValue(CommodityKind.Bladder) < ths.Actor.Motives.GetMax(CommodityKind.Bladder))) && (ths.Actor.Motives.GetValue(CommodityKind.Bladder) < RoutineMachine.TeleportBase.kThresholdBladder))
                {
                    if (ths.Target.Upgradable.CurrentUpgrade == Upgrade.SoupUpSpeakers)
                    {
                        ths.Target.StartSpeakerEffects();
                    }
                    if (!paramValue)
                    {
                        paramValue = true;
                        ths.AnimateSim("InAirIdle");
                    }
                    ths.Actor.EnableCensor(Sim.CensorType.LowerBody);
                    ths.AnimateSim("SatisfyBladder");
                    ths.Actor.Motives.LerpToFill(ths, CommodityKind.Bladder, RoutineMachine.TeleportBase.kChangeBladderTime);
                    ths.Actor.ClearExitReasons();
                    ths.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(ths.SatisfyBladderDelegate), ths.mCurrentStateMachine);
                    ths.Actor.ClearExitReasons();
                    ths.AnimateSim("InAirIdle");
                }

                if ((ths.Actor.Motives.HasMotive(CommodityKind.Hygiene) && (ths.Actor.Motives.GetValue(CommodityKind.Hygiene) < ths.Actor.Motives.GetMax(CommodityKind.Hygiene))) && (ths.Actor.Motives.GetValue(CommodityKind.Hygiene) < RoutineMachine.TeleportBase.kThresholdHygiene))
                {
                    if (ths.Target.Upgradable.CurrentUpgrade == Upgrade.SoupUpSpeakers)
                    {
                        ths.Target.StartSpeakerEffects();
                    }

                    if (!paramValue)
                    {
                        paramValue = true;
                        ths.AnimateSim("InAirIdle");
                    }
                    ths.AddSynchronousOneShotScriptEventHandler(0x3e9, ths.ShowerStartEvent);
                    ths.AddSynchronousOneShotScriptEventHandler(0x3ea, ths.ShowerEndEvent);
                    OutfitCategories naked = OutfitCategories.Naked;
                    if (ths.Actor.TraitManager.HasElement(TraitNames.NeverNude))
                    {
                        naked = OutfitCategories.Swimwear;
                    }
                    else
                    {
                        ths.Actor.EnableCensor(Sim.CensorType.FullBody);
                    }

                    using (Sim.SwitchOutfitHelper helper = new Sim.SwitchOutfitHelper(ths.Actor, Sim.ClothesChangeReason.GoingToBathe, naked, false))
                    {
                        helper.Start();
                        helper.Wait(false);
                        helper.ChangeOutfit();
                    }

                    flag2 = true;
                    ths.AnimateSim("SatisfyHygenie");
                    ths.Actor.Motives.LerpToFill(ths, CommodityKind.Hygiene, RoutineMachine.TeleportBase.kChangeHygieneTime);
                    ths.Actor.ClearExitReasons();
                    ths.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), new InteractionInstance.InsideLoopFunction(ths.SatisfyHygieneDelegate), ths.mCurrentStateMachine);
                    ths.Actor.ClearExitReasons();
                    ths.AnimateSim("InAirIdle");
                    BuffManager buffManager = ths.Actor.BuffManager;
                    buffManager.RemoveElement(BuffNames.Singed);
                    buffManager.RemoveElement(BuffNames.SingedElectricity);
                    buffManager.RemoveElement(BuffNames.GarlicBreath);
                    if (ths.Actor.SimDescription.IsMummy)
                    {
                        buffManager.AddElement(BuffNames.Soaked, Origin.FromShower);
                    }
                    if (ths.Actor.HasTrait(TraitNames.Hydrophobic))
                    {
                        ths.Actor.PlayReaction(ReactionTypes.Cry, ths.Target, ReactionSpeed.AfterInteraction);
                    }
                }

                if (ths.Actor.GetOutfitForClothingChange(ths.NewClothesStyle, out categories2) || flag2)
                {
                    ths.mCurrentStateMachine.SetParameter("inAirIdle", paramValue);
                    ths.AnimateSim("PrepareToChangeClothes");
                    using (Sim.SwitchOutfitHelper helper2 = new Sim.SwitchOutfitHelper(ths.Actor, Sim.ClothesChangeReason.Force, categories2))
                    {
                        helper2.Start();
                        helper2.Wait(false);
                        helper2.ChangeOutfit();
                    }
                }

                ths.Actor.AutoEnableCensor();
                ths.AddSynchronousOneShotScriptEventHandler(0x64, ths.TeleportOutEvent);
                ths.AnimateSim("DropThroughPortal");
                ths.Target.StopSpeakerEffects();
                if (ths.mSituation != null)
                {
                    ths.mSituation.Exit();
                    ths.mSituation = null;
                }

                if (ths.Actor.Motives.GetValue(CommodityKind.Energy) < RoutineMachine.TeleportBase.kMinEnergyToTeleport)
                {
                    ths.Target.StartDreamscapeEffects();
                    ths.Target.Repairable.UpdateBreakage(0x64, ths.Actor);
                    ths.RunDreamscape();
                    ths.Target.StopDreamscapeEffects();
                }

                flag = ths.DoTeleport(obj2);
                ths.AnimateSim("ExitGetReady");
                ths.EnterStateMachine("routinemachine_store", "EnterBeTeleported", "x", "routinemachine");
                ths.AddSynchronousOneShotScriptEventHandler(0x64, ths.TeleportBackEvent);
                ths.AnimateSim("BeTeleported");
                ths.AnimateSim("ExitBeTeleported");
                ths.StandardExit();
            }

            ths.Target.StopPortalReturnVisualEffects();
            if (ths.mSituation != null)
            {
                ths.mSituation.Exit();
            }
            return(flag);
        }
Example #16
0
        public override bool Run()
        {
            try
            {
                if (!Target.SimLine.WaitForTurn(this, SimQueue.WaitBehavior.DefaultEvict, ~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), Shower.kTimeToWaitToEvict))
                {
                    return false;
                }

                try
                {
                    mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, OutfitChoice);
                }
                catch
                {
                    return false;
                }

                mSwitchOutfitHelper.Start();
                if (Actor.HasTrait(TraitNames.Hydrophobic))
                {
                    Actor.PlayReaction(ReactionTypes.WhyMe, Target as GameObject, ReactionSpeed.ImmediateWithoutOverlay);
                }
                if (Actor.HasTrait(TraitNames.Daredevil))
                {
                    TraitTipsManager.ShowTraitTip(0xb82d0015b9294260L, Actor, TraitTipsManager.TraitTipCounterIndex.Daredevil, TraitTipsManager.kDaredevilCountOfShowersTaken);
                }

                if (!Actor.RouteToSlotAndCheckInUse(Target, Slot.RoutingSlot_0))
                {
                    return false;
                }

                if (EnforcePrivacy)
                {
                    mSituation = new Shower.ShowerPrivacySituation(this);
                    if (!mSituation.Start())
                    {
                        return false;
                    }
                }

                StandardEntry();
                if (!Actor.RouteToSlot(Target, Slot.RoutingSlot_0))
                {
                    if (mSituation != null)
                    {
                        mSituation.Exit();
                    }

                    StandardExit();
                    return false;
                }
                if (Autonomous)
                {
                    mPriority = new InteractionPriority(InteractionPriorityLevel.UserDirected);
                }
                mSwitchOutfitHelper.Wait(true);
                bool daredevilPerforming = Actor.DaredevilPerforming;
                bool flag2 = Actor.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed;
                EnterStateMachine("Shower", "Enter", "x");
                SetActor("Shower", Target);
                if (mSituation != null)
                {
                    mSituation.StateMachine = mCurrentStateMachine;
                }
                SetParameter("IsShowerTub", Target.IsShowerTub);
                SetParameter("SimShouldCloseDoor", true); // Required to be "true" for the Oufit switcher
                SetParameter("SimShouldClothesChange", ((!daredevilPerforming && !flag2) && !Actor.OccultManager.DisallowClothesChange()) && !Actor.BuffManager.DisallowClothesChange());
                
                bool paramValue = false;
                if ((Target.BoobyTrapComponent != null) && Target.BoobyTrapComponent.CanTriggerTrap(Actor.SimDescription))
                {
                    paramValue = !Actor.OccultManager.DisallowClothesChange() && !Actor.BuffManager.DisallowClothesChange();
                }
                SimDescription description = ((Target.BoobyTrapComponent != null) && (Target.BoobyTrapComponent.TrapSetter != 0L)) ? SimDescription.Find(Target.BoobyTrapComponent.TrapSetter) : null;
                if (((description != null) && description.IsFairy) && Actor.BuffManager.HasElement(BuffNames.TrickedByAFairy))
                {
                    paramValue = false;
                }
                SetParameter("isBoobyTrapped", paramValue);
                mSwitchOutfitHelper.AddScriptEventHandler(this);
                AddOneShotScriptEventHandler(0x3e9, EventCallbackStartShoweringSound);
                if (Actor.HasTrait(TraitNames.Virtuoso) || RandomUtil.RandomChance((float)Target.TuningShower.ChanceOfSinging))
                {
                    AddOneShotScriptEventHandler(0xc8, EventCallbackStartSinging);
                }
                PetStartleBehavior.CheckForStartle(Target as GameObject, StartleType.ShowerOn);
                AnimateSim("Loop Shower");
                Actor.BuffManager.AddElement(BuffNames.SavingWater, Origin.FromShower, ProductVersion.EP2, TraitNames.EnvironmentallyConscious);
                mShowerStage.ResetCompletionTime(GetShowerTime());
                StartStages();
                if (Actor.HasTrait(TraitNames.EnvironmentallyConscious))
                {
                    BeginCommodityUpdate(CommodityKind.Hygiene, Shower.kEnvironmentallyConsciousShowerSpeedMultiplier);
                }
                if (Actor.SimDescription.IsPlantSim)
                {
                    ModifyCommodityUpdate(CommodityKind.Hygiene, Shower.kPlantSimHygieneModifier);
                }

                BeginCommodityUpdates();

                if (paramValue)
                {
                    ApplyBoobyTrapOutfit();
                    if ((description != null) && description.IsFairy)
                    {
                        Actor.BuffManager.AddElement(BuffNames.TrickedByAFairy, Origin.FromFairy);
                    }
                }

                bool succeeded = false;
                try
                {
                    try
                    {
                        Target.SimInShower = Actor;
                        succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached), DuringShower, null);
                        if (HavingWooHoo && Actor.HasExitReason(ExitReason.StageComplete))
                        {
                            succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached | ExitReason.StageComplete), DuringShower, null);
                        }
                    }
                    finally
                    {
                        Target.SimInShower = null;
                    }

                    while (HavingWooHoo)
                    {
                        SpeedTrap.Sleep(10);
                    }
                }
                finally
                {
                    EndCommodityUpdates(succeeded);
                }

                Shower.WaitToLeaveShower(Actor, Target);
                if (succeeded)
                {
                    ShowerEx.ApplyPostShowerEffects(Actor, Target);
                }
                if (paramValue)
                {
                    SetParameter("isBoobyTrapped", false);
                    AddOneShotScriptEventHandler(0xc9, EventCallbackStopSinging);
                    AddOneShotScriptEventHandler(0x3ea, EventCallbackStopShoweringSound);
                    if ((description != null) && description.IsFairy)
                    {
                        AnimateSim("TriggerFairyTrap");
                    }
                    else
                    {
                        AnimateSim("Booby Trap Reaction");
                    }
                    AddOneShotScriptEventHandler(0x3e9, EventCallbackStartShoweringSound);
                    AnimateSim("Loop Shower");
                    RemoveBoobyTrapOutfit();
                    SpeedTrap.Sleep(60);
                }

                try
                {
                    if (flag2 && succeeded)
                    {
                        mSwitchOutfitHelper.Dispose();
                        try
                        {
                            mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, OutfitChoice);
                            mSwitchOutfitHelper.Start();
                            mSwitchOutfitHelper.Wait(false);
                            mSwitchOutfitHelper.ChangeOutfit();
                        }
                        catch
                        { }
                    }
                    bool flag5 = false;
                    if ((flag2 && succeeded) || (!flag2 && !daredevilPerforming))
                    {
                        SetParameter("SimShouldClothesChange", !Actor.OccultManager.DisallowClothesChange());
                        mSwitchOutfitHelper.Dispose();
                        try
                        {
                            mSwitchOutfitHelper = new Sim.SwitchOutfitHelper(Actor, GetOutfitReason(Actor));
                            mSwitchOutfitHelper.Start();
                            mSwitchOutfitHelper.AddScriptEventHandler(this);
                            mSwitchOutfitHelper.Wait(false);
                        }
                        catch
                        { }

                        flag5 = true;
                    }

                    if (Target.Cleanable != null)
                    {
                        Target.Cleanable.DirtyInc(Actor);
                    }

                    AddOneShotScriptEventHandler(0xc9, EventCallbackStopSinging);
                    AddOneShotScriptEventHandler(0x3ea, EventCallbackStopShoweringSound);
                    if (flag5 && InventingSkill.IsBeingDetonated(Target as GameObject))
                    {
                        SetParameter("SimShouldClothesChange", false);
                        mSwitchOutfitHelper.Abort();
                        mSwitchOutfitHelper.Dispose();
                    }

                    if ((Target.Repairable != null) && (Target.Repairable.UpdateBreakage(Actor)))
                    {
                        Target.StartBrokenFXInAnim(mCurrentStateMachine);
                        AnimateSim("Exit Broken");
                    }
                    else
                    {
                        AnimateSim("Exit Working");
                    }

                    if ((Actor.SimDescription.IsMummy || Actor.DaredevilPerforming) || (Actor.TraitManager.HasElement(TraitNames.Slob) && RandomUtil.RandomChance01(TraitTuning.SlobTraitChanceToLeavePuddle)))
                    {
                        PuddleManager.AddPuddle(Actor.Position);
                    }

                    if (succeeded)
                    {
                        Actor.BuffManager.RemoveElement(BuffNames.GotFleasHuman);
                    }
                }
                finally
                {
                    StandardExit();
                }
                return succeeded;
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return false;
            }
        }
Example #17
0
        public static bool SitDown(HotTubBase ths, Sim s, Slot slot, HotTubSeat seat, Sim.SwitchOutfitHelper switchOutfitHelper, bool isSkinnyDipping, Sim invitedBy, bool isAutonomous)
        {
            bool flag       = isSkinnyDipping;
            bool paramValue = true;

            if ((s.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Swimwear) && !isSkinnyDipping)
            {
                paramValue = false;
            }

            if ((s.OccultManager.DisallowClothesChange() || (s.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Singed)) || s.BuffManager.DisallowClothesChange())
            {
                paramValue = false;
            }

            if ((s.Service != null) && (s.Service.ServiceType == ServiceType.GrimReaper))
            {
                paramValue = false;
            }

            if (s.GetCurrentOutfitCategoryFromOutfitInGameObject() == OutfitCategories.Naked)
            {
                flag = false;
            }
            else
            {
                s.RefreshCurrentOutfit(false);
            }

            if (!paramValue)
            {
                flag = false;
            }

            ths.PartComponent.SetSimAtPart(s, slot);
            switchOutfitHelper.Wait(true);
            StateMachineClient smc = StateMachineClient.Acquire(s, "HotTub", AnimationPriority.kAPDefault);

            if (smc == null)
            {
                s.AddExitReason(ExitReason.NullValueFound);
                ths.PartComponent.SetSimAtPart(null, slot);
                switchOutfitHelper.Dispose();
                return(false);
            }

            smc.SetActor("x", s);
            smc.SetActor("hotTub", ths);
            smc.SetParameter("IkSuffix", seat.IKSuffix);
            smc.SetParameter("isMirrored", seat.IsMirrored);
            smc.SetParameter("doClothesSpin", paramValue);
            smc.SetParameter("playLookaround", isSkinnyDipping && ths.IsFirstSkinnyDipper());
            smc.AddOneShotScriptEventHandler(0x67, new SacsEventHandler(ths.TubEntered));
            smc.AddOneShotScriptEventHandler(0xc9, new SacsEventHandler(seat.SlotSimIntoHottub));
            smc.AddPersistentScriptEventHandler(0x69, new SacsEventHandler(seat.UnparentAndUpdateDrinkStatus));
            if (flag)
            {
                smc.AddOneShotScriptEventHandler(0x67, new SacsEventHandler(seat.CreateClothingPile));
            }

            smc.EnterState("x", "Enter");
            switchOutfitHelper.AddScriptEventHandler(smc);
            Glass actor = null;

            seat.DrinkRef = null;
            Glass.CarryingGlassPosture posture = s.Posture as Glass.CarryingGlassPosture;
            if (posture != null)
            {
                actor = posture.ObjectBeingCarried as Glass;
                CarrySystem.ExitCarry(s);
                actor.FadeOut(true);
                actor.UnParent();
                s.PopPosture();
                actor.ParentToSlot(ths, seat.DrinkSlot);
                actor.FadeIn();
                smc.SetActor("drink", actor);
                seat.DrinkRef = actor;
            }

            s.InteractionQueue.CancelAllInteractionsByType(Glass.Drink.Singleton);
            StereoCheap cheap = s.Inventory.Find <StereoCheap>();

            if (((cheap != null) && !ths.IsSlotOccupied(ths.BoomboxSlot)) && s.Inventory.TryToRemove(cheap))
            {
                cheap.SetOpacity(0f, 0f);
                if (cheap.ParentToSlot(ths, ths.BoomboxSlot))
                {
                    cheap.FadeIn(false);
                }
                else
                {
                    cheap.FadeIn(false, 0f);
                    s.Inventory.TryToAdd(cheap);
                }
            }

            smc.SetParameter("hasDrink", actor != null);
            smc.RequestState("x", "Sitting");
            HotTubPosture posture2 = new HotTubPosture(s, ths, smc, seat);

            posture2.InvitedBy          = invitedBy;
            posture2.AutonomouslyChosen = isAutonomous;
            s.Posture = posture2;
            if (!s.Posture.Satisfies(CommodityKind.InHotTub, ths))
            {
                s.AddExitReason(ExitReason.FailedToStart);
                ths.PartComponent.SetSimAtPart(null, slot);
                seat.DrinkRef = null;
                return(false);
            }

            EventTracker.SendEvent(new Event(EventTypeId.kGoHotTubbing, s, ths));
            if (isSkinnyDipping)
            {
                StartSkinnyDipBroadcastersAndSendWishEvents(ths, s);
            }
            return(true);
        }