public static void ApplyPostShowerEffects(Sim actor, IShowerable shower) { BuffManager buffManager = actor.BuffManager; buffManager.RemoveElement(BuffNames.Singed); buffManager.RemoveElement(BuffNames.SingedElectricity); buffManager.RemoveElement(BuffNames.GarlicBreath); SimDescription simDescription = actor.SimDescription; simDescription.RemoveFacePaint(); if (simDescription.IsMummy) { buffManager.AddElement(BuffNames.Soaked, Origin.FromShower); } if (RandomUtil.RandomChance((float)shower.TuningShower.ChanceOfExhileratingShowerBuff)) { buffManager.AddElement(BuffNames.ExhilaratingShower, Origin.FromNiceShower); } if (actor.HasTrait(TraitNames.Hydrophobic)) { actor.PlayReaction(ReactionTypes.Cry, shower as GameObject, ReactionSpeed.AfterInteraction); } else if (shower.ShouldGetColdShower) { actor.BuffManager.AddElement(BuffNames.ColdShower, Origin.FromCheapShower); EventTracker.SendEvent(EventTypeId.kGotColdShowerBuff, actor, shower); } // Custom else if ((shower.Cleanable != null) && (shower.Cleanable.NeedsToBeCleaned)) { actor.PlayReaction(ReactionTypes.Retch, shower as GameObject, ReactionSpeed.AfterInteraction); } actor.Motives.SetMax(CommodityKind.Hygiene); }
public override void OnTimeout(BuffManager bm, BuffInstance bi, Buff.OnTimeoutReasons reason) { bm.AddElement(DrinkingBuffs.sHangover, Origin.FromJuice); }
public void TriggerDisgrace() { // Test New 96? CelebrityManager This = CelebrityManager_; Sim ownerSim = This.OwnerSim; BuffManager buffManager = This.OwnerSim.BuffManager; if (This.mDisgracefulActionQueue != null && This.mDisgracefulActionQueue.Count != 0) { DisgracefulActionEvent disgracefulActionEvent = This.mDisgracefulActionQueue[0]; DisgracefulActionType disgracefulActionType = disgracefulActionEvent.DisgracefulActionType; This.mDisgracefulActionQueue.Remove(disgracefulActionEvent); CelebrityDisgracefulActionStaticData value = null; if (!CantBeDisgraced(This) && CelebrityUtil.sCelebrityDisgracefulActionData.TryGetValue(disgracefulActionType, out value) /* || !(Sims3.Gameplay.Moded.DGSHelperCommands.kNoDisgracedInIsPlayer && (ownerSim.IsInActiveHousehold || ownerSim.IsSafeInActiveHousehold)) */) { buffManager.RemoveElement(BuffNames.PubliclyDisgraced); SimDescription simDescription = SimDescription.Find(disgracefulActionEvent.TargetId); bool flag = disgracefulActionType == DisgracefulActionType.Cheating && !ownerSim.HasTrait(TraitNames.NoJealousy); foreach (Relationship relationship in ownerSim.SocialComponent.Relationships) { if (relationship.SimDescriptionB != simDescription) { if (flag && relationship.AreRomantic()) { Sim createdSim = relationship.SimDescriptionB.CreatedSim; if (createdSim != null) { SocialComponent.OnIWasCheatedOn(createdSim, ownerSim.SimDescription, simDescription, JealousyLevel.Medium); } } relationship.LTR.UpdateLiking(0f - CelebrityManager.kLTRLostFromDisgrace); } } if (value != null) { buffManager.AddElement(BuffNames.PubliclyDisgraced, value.DisgracedOrigin); } else { buffManager.AddElement(BuffNames.PubliclyDisgraced, Origin.FromFalselyAccused); } if (value != null && value.DisgracedOrigin == Origin.FromFalselyAccused) { ownerSim.CelebrityManager.IncrementFalselyAccused(); } else { ownerSim.CelebrityManager.IncrementPubliclyDisgraced(); } if (value != null) { ownerSim.ShowTNSAndPlayStingIfSelectable("sting_generic_tragic", value.TnsId, null, ownerSim, null, null, new bool[1] { ownerSim.IsFemale }, ownerSim.IsFemale, ownerSim); } } } }
public static void OnMarried(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i) { try { string failReason = null; if ((actor.Household == target.Household) || (!MovingSituation.MovingInProgress && ((Household.ActiveHousehold == null) || InWorldSubState.IsEditTownValid(Household.ActiveHousehold.LotHome, ref failReason)))) { Sim actorSim; Sim targetSim; BuffManager actorBuffManager = actor.BuffManager; BuffManager targetBuffManager = target.BuffManager; actorBuffManager.AddElement(BuffNames.JustMarried, Origin.FromSocialization); targetBuffManager.AddElement(BuffNames.JustMarried, Origin.FromSocialization); BuffJustMarried.BuffInstanceJustMarried element = actorBuffManager.GetElement(BuffNames.JustMarried) as BuffJustMarried.BuffInstanceJustMarried; if (element != null) { element.CreateGiftAlarm(actorBuffManager); } actorBuffManager.RemoveElement(BuffNames.NewlyEngaged); actorBuffManager.RemoveElement(BuffNames.ParentsBlessing); targetBuffManager.RemoveElement(BuffNames.NewlyEngaged); targetBuffManager.RemoveElement(BuffNames.ParentsBlessing); ActiveTopic.AddToSim(actor, "Wedding"); ActiveTopic.AddToSim(target, "Wedding"); Relationship relationship = Relationship.Get(actor, target, true); relationship.LTR.RemoveInteractionBit(LongTermRelationship.InteractionBits.Divorce); relationship.LTR.AddInteractionBit(LongTermRelationship.InteractionBits.Marry); if (actor.IsNPC && !target.IsNPC) { actorSim = target; targetSim = actor; } else if (!actor.IsNPC && target.IsNPC) { actorSim = actor; targetSim = target; } else { SimDescription proposerDesc = relationship.ProposerDesc; actorSim = (proposerDesc == null) ? null : proposerDesc.CreatedSim; if (actorSim == null) { if (RandomUtil.CoinFlip()) { actorSim = actor; } else { actorSim = target; } } targetSim = target; if (actorSim == target) { targetSim = actor; } } SocialCallback.GiveDaysOffIfRequired(actorSim, targetSim); MidlifeCrisisManager.OnBecameMarried(actor.SimDescription, target.SimDescription); relationship.SetMarriedInGame(); if (SeasonsManager.Enabled) { relationship.WeddingAnniversary = new WeddingAnniversary(SeasonsManager.CurrentSeason, (int)SeasonsManager.DaysElapsed); relationship.WeddingAnniversary.SimA = relationship.SimDescriptionA; relationship.WeddingAnniversary.SimB = relationship.SimDescriptionB; relationship.WeddingAnniversary.CreateAlarm(); } if (sStoryProgressionHandleMarriageName.Valid) { sStoryProgressionHandleMarriageName.Invoke <bool>(new object[] { actorSim.SimDescription, targetSim.SimDescription }); } else { targetSim.SimDescription.LastName = actorSim.SimDescription.LastName; foreach (Genealogy genealogy in targetSim.Genealogy.Children) { SimDescription simDescription = genealogy.SimDescription; if (((simDescription != null) && simDescription.TeenOrBelow) && (simDescription.CreatedSim != null)) { simDescription.LastName = actorSim.SimDescription.LastName; } } } actor.Genealogy.Marry(target.Genealogy); OnMoveInWith(actor, target, interaction, topic, i); SocialCallback.EndServiceForActor(actor); SocialCallback.EndServiceForActor(target); actorBuffManager.RemoveElement(BuffNames.MissedWedding); targetBuffManager.RemoveElement(BuffNames.MissedWedding); } } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(actor, target, e); } }
public void motive_motive_distress(Sim sim, CommodityKind commodity) { if (commodity == (CommodityKind)0x44440444) { return; } SimDescription simd = sim.SimDescription; BuffManager buffManager = sim.BuffManager; Motives moves = sim.Motives; switch (commodity) { case CommodityKind.Bladder: { bool flag = true; InteractionDefinition interactionDefinition; switch (simd.Species) { case CASAgeGenderFlags.Horse: interactionDefinition = Sim.HorsePee.Singleton; break; case CASAgeGenderFlags.Dog: case CASAgeGenderFlags.LittleDog: interactionDefinition = (InteractionDefinition)Sim.DogPeeStart.Singleton; break; case CASAgeGenderFlags.Cat: interactionDefinition = (InteractionDefinition)Sim.CatPeeStart.Singleton; break; default: interactionDefinition = Sim.BladderFailure.Singleton; break; } foreach (InteractionInstance interaction in sim.InteractionQueue.InteractionList) { if (interaction is Sim.DogPee || interaction is Sim.CatPee || interaction.InteractionDefinition == interactionDefinition) { flag = false; break; } } if (flag) { SwimmingInPool swimmingInPool = sim.Posture as SwimmingInPool; if (swimmingInPool == null) { InteractionInstance interactionInstance = interactionDefinition.CreateInstance(sim, sim, new InteractionPriority(InteractionPriorityLevel.High), false, false); Sim.DogPeeStart dogPeeStart = interactionInstance as Sim.DogPeeStart; if (dogPeeStart != null) { dogPeeStart.DoNotRoute = true; } else { Sim.CatPeeStart catPeeStart = interactionInstance as Sim.CatPeeStart; if (catPeeStart != null) { catPeeStart.DoNotRoute = true; } } if (sim.InteractionQueue.AddNext(interactionInstance) && simd.IsRaccoon) { sim.AddExitReason(ExitReason.BuffFailureState); } else { BuffInstance buffOfSolveCommodity = buffManager.GetBuffOfSolveCommodity(commodity); if (buffOfSolveCommodity != null && buffOfSolveCommodity.EffectValue <= 0) { ThoughtBalloonManager.BalloonData balloonData = new ThoughtBalloonManager.BalloonData(buffOfSolveCommodity.ThumbString); if (balloonData.IsValid) { balloonData.BalloonType = ThoughtBalloonTypes.kScreamBalloon; balloonData.mCoolDown = ThoughtBalloonCooldown.None; sim.ThoughtBalloonManager.ShowBalloon(balloonData); } } moves.SetMax(CommodityKind.Bladder); if (!simd.IsPet) { PuddleManager.AddPuddle(sim.Position); moves.SetValue(CommodityKind.Hygiene, -100f); if (GlobalFunctions.AreOtherSimsNearby(sim, BuffEmbarrassed.DistanceForEmbarrassedBuff)) { buffManager.AddElement(BuffNames.Embarrassed, Origin.FromPeeingSelf); } ActiveTopic.AddToSim(sim, "Embarrassment"); } else { MetaAutonomyVenueType metaAutonomyVenueType = sim.LotCurrent.GetMetaAutonomyVenueType(); if ((!simd.IsADogSpecies || metaAutonomyVenueType != MetaAutonomyVenueType.DogPark) && World.GetTerrainType(sim.Position) == TerrainType.LotFloor) { PuddleManager.AddPuddle(sim.Position); } } EventTracker.SendEvent(EventTypeId.kBladderFailure, sim); } Motive motive = moves.GetMotive(CommodityKind.Bladder); if (motive != null) { motive.PotionBladderDecayOverride = false; } } else { swimmingInPool.ContainerPool.PeeInPool(sim); } } break; } case CommodityKind.Hunger: case CommodityKind.VampireThirst: if (simd.IsFrankenstein) { OccultFrankenstein.PushFrankensteinShortOut(sim); } else if (!simd.IsGhost && !simd.IsDead && !IsCheckKillSimInteraction(sim)) { if (sim.Posture.Satisfies(CommodityKind.ScubaDiving, null) && !simd.IsMermaid) { sim.Kill(SimDescription.DeathType.ScubaDrown); } else if (sim.Posture.Satisfies(CommodityKind.SwimmingInPool, null) && !simd.IsMermaid) { sim.Kill(SimDescription.DeathType.Drown); } else if (SimTemperature.HasFrozenSolidInteraction(sim)) { sim.Kill(SimDescription.DeathType.Freeze, null, false); } else if (OccultMermaid.IsDehydrated(sim)) { sim.Kill(SimDescription.DeathType.MermaidDehydrated, null, false); } else { sim.Kill(sim.SimDescription.IsVampire ? SimDescription.DeathType.Thirst : SimDescription.DeathType.Starve); } } break; case CommodityKind.Temperature: { float value = moves.GetValue(CommodityKind.Temperature); if (value > 0f) { SimTemperature.PushSpontaneouslyCombustInteraction(sim); } else { SimTemperature.PushFreezeInteraction(sim); } break; } case CommodityKind.MermaidDermalHydration: OccultMermaid.CollapseFromDehydration(sim); break; } }
public void update_motive_buffs(Sim sim, CommodityKind commodity, int currentValue) { if (currentValue == -333) { return; } BuffManager buffManager = sim.BuffManager; SimDescription simd = sim.SimDescription; TraitManager traitManager = simd.TraitManager; MotiveTuning motiveTuning = sim.GetMotiveTuning(commodity); if (motiveTuning != null) { List <MotiveTuning.MotiveBuffTrigger> buffTriggers = motiveTuning.BuffTriggers; foreach (MotiveTuning.MotiveBuffTrigger item in buffTriggers) { if ((float)currentValue <= Math.Max(item.mTriggerValueStart, item.mTriggerValueEnd) && (float)currentValue >= Math.Min(item.mTriggerValueStart, item.mTriggerValueEnd)) { foreach (BuffNames item2 in item.mRemoveBuff) { if (item2 == BuffNames.Hungry) { buffManager.RemoveElement(BuffNames.HungryLikeTheWolf); } buffManager.RemoveElement(item2); } if (item.mAddBuff != BuffNames.Undefined) { if (item.mAddBuff == BuffNames.VeryHungry && simd.IsWerewolf && !buffManager.HasElement(BuffNames.HungryLikeTheWolf)) { buffManager.AddElement(BuffNames.HungryLikeTheWolf, Origin.None); } if (!buffManager.HasElement(item.mAddBuff)) { buffManager.AddElement(item.mAddBuff, Origin.None); } } if (item.mCustomClass != null) { item.mCustomClass.Invoke(null, new object[1] { sim }); } } else if (buffManager.IsPermaMoodlet(item.mAddBuff) && commodity != CommodityKind.Hygiene && commodity != CommodityKind.CatScratch && commodity != CommodityKind.MermaidDermalHydration) { buffManager.RemoveElement(item.mAddBuff); } } } if ((float)currentValue == Tuning.Min || (commodity == CommodityKind.Temperature && (float)currentValue == Tuning.Max)) { MotiveDistress(sim, commodity); } if (traitManager.HasElement(TraitNames.BroodingTrait)) { if (commodity == CommodityKind.Social && (float)currentValue <= kMisunderstoodSocialMotiveAddValue && !buffManager.HasElement(BuffNames.Misunderstood) && !buffManager.HasElement(BuffNames.NeedToBrood)) { buffManager.AddElement(BuffNames.Misunderstood, Origin.FromBeingBroodingTrait); } if (commodity == CommodityKind.Social && (float)currentValue >= kMisunderstoodSocialMotiveRemoveValue) { buffManager.RemoveElement(BuffNames.Misunderstood); } } if ((commodity == CommodityKind.Hygiene || commodity == CommodityKind.Energy) && (buffManager.HasElement(BuffNames.SickAndTired) || buffManager.HasElement(BuffNames.PestilencePlague))) { BuffSickAndTired.CheckForStartStopFlySwarmEffect(sim, commodity, currentValue); } if (Commodity == CommodityKind.AuraPower) { BuffFairyAuraProjecting.BuffAuraInstanceBase buffAuraInstanceBase = buffManager.GetElement(BuffNames.FairyAuraProjectingSoothe) as BuffFairyAuraProjecting.BuffAuraInstanceBase; if (buffAuraInstanceBase == null) { buffAuraInstanceBase = (buffManager.GetElement(BuffNames.FairyAuraProjectingCreative) as BuffFairyAuraProjecting.BuffAuraInstanceBase); } if (buffAuraInstanceBase == null) { buffAuraInstanceBase = (buffManager.GetElement(BuffNames.FairyAuraProjectingMind) as BuffFairyAuraProjecting.BuffAuraInstanceBase); } if (buffAuraInstanceBase != null) { buffAuraInstanceBase.UpdateColor(); } } }
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); }
protected override void OnPerform() { try { mScenario.IncStat("TriggerDisgraceTask"); CelebrityManager manager = mScenario.Sim.CelebrityManager; if ((manager.mDisgracefulActionQueue == null) || (manager.mDisgracefulActionQueue.Count == 0x0)) { mScenario.IncStat("DisgraceTask: No Task Event"); return; } CelebrityDisgracefulActionStaticData data; DisgracefulActionEvent item = manager.mDisgracefulActionQueue[0x0]; manager.mDisgracefulActionQueue.Remove(item); DisgracefulActionType disgracefulActionType = item.DisgracefulActionType; if (manager.CantBeDisgraced()) { mScenario.IncStat("DisgraceTask: Not Disgracable"); return; } if (!CelebrityUtil.sCelebrityDisgracefulActionData.TryGetValue(disgracefulActionType, out data)) { mScenario.IncStat("DisgraceTask: No Task Data"); return; } BuffManager buffManager = null; if (mScenario.Sim.CreatedSim != null) { buffManager = mScenario.Sim.CreatedSim.BuffManager; } if (buffManager != null) { buffManager.RemoveElement(BuffNames.PubliclyDisgraced); } SimDescription otherNaughty = ManagerSim.Find(item.TargetId); bool flag = (disgracefulActionType == DisgracefulActionType.Cheating) && !mScenario.Sim.TraitManager.HasElement(TraitNames.NoJealousy); int change = NRaas.StoryProgression.Main.GetValue <RelationshipChangeOption, int>(); if (change > 0) { change = 0; } foreach (Relationship relationship in Relationship.Get(mScenario.Sim)) { SimDescription other = relationship.GetOtherSimDescription(mScenario.Sim); if (other == otherNaughty) { continue; } if (other.ToddlerOrBelow) { continue; } bool testFriendship = true; if (!mScenario.Cares(other, disgracefulActionType, mScenario.GetValue <RelationDropChanceOption, int>(), out testFriendship)) { mScenario.IncStat("DisgraceTask: Sim Doesn't Care"); continue; } if (flag && relationship.AreRomantic()) { Sim createdSim = other.CreatedSim; if (createdSim != null) { SocialComponent.OnIWasCheatedOn(createdSim, mScenario.Sim, otherNaughty, JealousyLevel.Medium); } } if (relationship.AreFriends()) { mScenario.AddScoring("DisgraceTask: Relation Change", change); relationship.LTR.UpdateLiking(change); } } if (buffManager != null) { buffManager.AddElement(BuffNames.PubliclyDisgraced, data.DisgracedOrigin); } if (data.DisgracedOrigin == Origin.FromFalselyAccused) { manager.IncrementFalselyAccused(); } else { manager.IncrementPubliclyDisgraced(); } Sim sim = mScenario.Sim.CreatedSim; if (sim != null) { mScenario.IncStat("DisgraceTask: Display Message"); sim.ShowTNSAndPlayStingIfSelectable("sting_generic_tragic", data.TnsId, null, sim, null, null, new bool[] { mScenario.Sim.IsFemale }, mScenario.Sim.IsFemale, new object[] { sim }); } } catch (Exception e) { Common.Exception(mScenario.Sim, e); } }