コード例 #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();
                }
            }
        }
コード例 #2
0
ファイル: OccultGenieEx.cs プロジェクト: Robobeurre/NRaas
        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();
                }
            }
        }
コード例 #3
0
ファイル: TakeShowerEx.cs プロジェクト: Robobeurre/NRaas
        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;
            }
        }
コード例 #4
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);
     }
 }
コード例 #5
0
ファイル: SpongeBathEx.cs プロジェクト: Robobeurre/NRaas
        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;
            }
        }
コード例 #6
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;
                }
            }
        }
コード例 #7
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);
            }
        }
コード例 #8
0
ファイル: HotTubBaseEx.cs プロジェクト: yakoder/NRaas
        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);
        }