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(); } } }
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); } }
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; } }
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; } }
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; }
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); } }
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); }
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; } } }