public void HourlyCallback() { if (GameUtils.IsOnVacation() || GameUtils.IsUniversityWorld()) { return; } Pregnancy.mHourOfPregnancy++; if (Pregnancy.mHourOfPregnancy >= Abductor.Settings.mHourToStartPregnantWalk) { ActiveTopic.AddToSim(Abductee, "Pregnant", Abductee.SimDescription); if (!Pregnancy.mHasRequestedWalkStyle) { Pregnancy.mHasRequestedWalkStyle = Abductee.RequestWalkStyle(Sim.WalkStyle.Pregnant); } } if (Pregnancy.mHourOfPregnancy == Abductor.Settings.mHourToStartLabor) { for (int i = 0; i < Pregnancy.kNumberOfPuddlesForWaterBreak; i++) { PuddleManager.AddPuddle(Abductee.PositionOnFloor); } if (Abductee.IsSelectable) { StyledNotification.Show(new StyledNotification.Format(Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:BabyIsComingTNS", new object[] { Abductee }), StyledNotification.NotificationStyle.kGameMessageNegative)); } //Abductee.BuffManager.RemoveElement(AbductionBuffs.sXenogenesis); Abductee.BuffManager.AddElement(BuffsAndTraits.sBabyIsComing, Origin.FromPregnancy); if (Pregnancy.mContractionBroadcast != null) { Pregnancy.mContractionBroadcast.Dispose(); } Pregnancy.mContractionBroadcast = new ReactionBroadcaster(Abductee, Pregnancy.kContractionBroadcasterParams, new ReactionBroadcaster.BroadcastCallback(StartReaction), new ReactionBroadcaster.BroadcastCallback(CancelReaction)); Abductee.AddInteraction(TakeToHospitalEx.Singleton); InteractionInstance interaction = Pregnancy.HaveContraction.Singleton.CreateInstance(Abductee, Abductee, new InteractionPriority(InteractionPriorityLevel.High, 10f), false, false); interaction.Hidden = true; Abductee.InteractionQueue.Add(interaction); Pregnancy.mContractionsAlarm = Abductee.AddAlarmRepeating(5f, TimeUnit.Minutes, new AlarmTimerCallback(Pregnancy.TriggerContraction), 5f, TimeUnit.Minutes, "Alien Pregnancy Trigger Contractions Alarm", AlarmType.AlwaysPersisted); EventTracker.SendEvent(EventTypeId.kPregnancyContractionsStarted, Abductee); } if (Pregnancy.mHourOfPregnancy == Abductor.Settings.mHoursOfPregnancy) { HaveTheBaby(); } SetPregnancyMorph(); }
protected override bool Run() { GameObject objectToDry = base.GetSelectedObject() as GameObject; PuddleManager.RemoveFlowingPuddle(objectToDry); ChaosModPainting.FloodedObjects.Remove(objectToDry); return(true); }
protected override bool Run() { GameObject[] lotObjs = base.Target.LotCurrent.GetObjects <GameObject>(); PuddleManager.FlowingPuddleTuning noah = new PuddleManager.FlowingPuddleTuning(); noah.MaxNumPuddles = 100; noah.SpawnSpeedInMinutes = 1; foreach (GameObject obj2 in lotObjs) { PuddleManager.AddFlowingPuddle(obj2, noah); ChaosModPainting.FloodedObjects.Add(obj2); } return(true); }
protected override bool Run() { base.StandardEntry(); GameObject objectToFlood = base.GetSelectedObject() as GameObject; if (ChaosModPainting.FloodedObjects.Contains(objectToFlood)) { SimpleMessageDialog.Show("Error", "Object is already flooded"); } else { PuddleManager.FlowingPuddleTuning noah = new PuddleManager.FlowingPuddleTuning(); noah.MaxNumPuddles = 100; PuddleManager.AddFlowingPuddle(objectToFlood, noah); ChaosModPainting.FloodedObjects.Add(objectToFlood); } base.StandardExit(); return(true); }
protected override bool Run() { base.StandardEntry(); if (ChaosModPainting.FloodedObjects.Count <= 0) { SimpleMessageDialog.Show("Error", "No flooded objects on lot"); } else { foreach (GameObject obj2 in ChaosModPainting.FloodedObjects) { PuddleManager.RemoveFlowingPuddle(obj2); ChaosModPainting.FloodedObjects.Remove(obj2); } } base.StandardExit(); return(true); }
public static void PlacePuddleIfSprayableEx(ulong lotID, LotLocation loc, Vector3 pos, bool set, short startingRoomId) { for (sbyte i = loc.mLevel; i >= 0; i = (sbyte)(i - 1)) { LotLocation location = new LotLocation(loc.mX, loc.mZ, i, 0); if (World.GetRoomId(lotID, location, eRoomDefinition.LightBlocking) == startingRoomId) { foreach (ObjectGuid guid in World.GetObjects(lotID, location)) { ISprinklable sprinklable = guid.ObjectFromId <ISprinklable>(); if (sprinklable != null) { sprinklable.OnSprinkled(); } IPlanterBowl bowl = guid.ObjectFromId <IPlanterBowl>(); if (bowl != null) { WaterContainedPlant(bowl); } ISoilRug rug = guid.ObjectFromId <ISoilRug>(); if (rug != null) { WaterContainedPlant(rug); } } if (World.HasSolidFloor(lotID, location) && ((i != 0) || (World.GetTerrainType(pos.x, pos.z, 0) == 0x20))) { if (!Tempest.Settings.mSprinklersSpawnPuddles || !PuddleManager.IsValidPuddleLocation(lotID, location)) { break; } World.SetPuddle(lotID, location, set); return; } } } }
protected override OptionResult Run(Lot lot, Household me) { if (lot == null) { return(OptionResult.Failure); } World.DecayLeaves(lot.LotId, 1f); foreach (GameObject obj in lot.GetObjects <GameObject>()) { if (obj.InUse) { continue; } if (obj.InInventory) { continue; } if (obj.IsCleanable) { obj.Cleanable.ForceClean(); } Hamper hamper = obj as Hamper; if (hamper != null) { hamper.RemoveClothingPiles(); } IThrowAwayable awayable = obj as IThrowAwayable; if ((awayable != null) && (!awayable.InUse) && (awayable.HandToolAllowUserPickupBase()) && (awayable.ShouldBeThrownAway()) && ((awayable.Parent == null) || (!awayable.Parent.InUse)) && (!(awayable is Bar.Glass)) && (!(awayable is Bill))) { bool flag = false; if (awayable is BarTray) { foreach (Slot slot in awayable.GetContainmentSlots()) { if (awayable.GetContainedObject(slot) is Bar.Glass) { flag = true; break; } } } if (!flag) { awayable.ThrowAwayImmediately(); } } if (obj is IDestroyOnMagicalCleanup) { obj.FadeOut(false, true); } } lot.FireManager.RestoreObjects(); LotLocation[] puddles = World.GetPuddles(lot.LotId, LotLocation.Invalid); if (puddles.Length > 0x0) { foreach (LotLocation location in puddles) { if ((lot.TombRoomManager == null) || !lot.TombRoomManager.IsObjectInATombRoom(location)) { PuddleManager.RemovePuddle(lot.LotId, location); } } } LotLocation[] burntTiles = World.GetBurntTiles(lot.LotId, LotLocation.Invalid); if (burntTiles.Length > 0x0) { foreach (LotLocation location2 in burntTiles) { if ((lot.LotLocationIsPublicResidential(location2)) && ((lot.TombRoomManager == null) || !lot.TombRoomManager.IsObjectInATombRoom(location2))) { World.SetBurnt(lot.LotId, location2, false); } } } if (me != null) { List <Fridge> fridges = new List <Fridge>(lot.GetObjects <Fridge>()); if (fridges.Count > 0) { Fridge fridge = fridges[0]; if ((fridge != null) && (me.SharedFridgeInventory != null) && (me.SharedFamilyInventory.Inventory != null)) { foreach (ServingContainer container in Sims3.Gameplay.Queries.GetObjects <ServingContainer>(lot)) { if ((!container.InUse) && (fridge.HandToolAllowDragDrop(container)) && (container.HasFood) && (container.HasFoodLeft()) && (!container.IsSpoiled) && (container.GetQuality() >= Quality.Neutral)) { me.SharedFridgeInventory.Inventory.TryToAdd(container, false); } } } } } foreach (Sim sim in lot.GetAllActors()) { if (sim.Inventory == null) { continue; } foreach (IThrowAwayable awayable in sim.Inventory.FindAll <IThrowAwayable>(true)) { if (awayable == null) { continue; } if (!awayable.HandToolAllowUserPickupBase()) { continue; } if (!awayable.ShouldBeThrownAway()) { continue; } if (awayable.InUse) { continue; } if ((awayable is Newspaper) && !(awayable as Newspaper).IsOld) { continue; } if (awayable is TrashPileOpportunity) { continue; } if ((awayable is PreparedFood) && !(awayable as PreparedFood).IsSpoiled) { continue; } awayable.ThrowAwayImmediately(); } } return(OptionResult.SuccessClose); }
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 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 override void HourlyCallback() { if (GameUtils.IsOnVacation() || GameUtils.IsUniversityWorld()) { Common.DebugNotify("AlienPregnancy.HourlyCallback - Pregnancy paused"); return; } mHourOfPregnancy++; string msg = mMom.FullName + Common.NewLine + "AlienPregnancy.HourlyCallback" + Common.NewLine + " - Hour: " + mHourOfPregnancy + Common.NewLine; if (mHourOfPregnancy == Aliens.Settings.mPregnancyShow) { msg += " - Showing Pregnancy"; InteractionInstance instance = ShowAlienPregnancy.Singleton.CreateInstance(mMom, mMom, new InteractionPriority(InteractionPriorityLevel.ESRB), false, false); instance.Hidden = true; mMom.InteractionQueue.AddNext(instance); Common.DebugNotify(msg); return; } if (mMom.Household.IsTouristHousehold) { msg += " - Mother is Tourist" + Common.NewLine; ForeignVisitorsSituation situation = ForeignVisitorsSituation.TryGetForeignVisitorsSituation(mMom); if (mHourOfPregnancy == Aliens.Settings.mForeignShowTNS && situation != null) { StyledNotification.Show(new StyledNotification.Format( Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:ForeignBabyIsComingTNS", new object[] { mMom }), StyledNotification.NotificationStyle.kGameMessagePositive)); } if (mHourOfPregnancy == Aliens.Settings.mForeignLeaves) { msg += " - Sending Pregnant Tourist Home"; if (situation != null) { situation.MakeGuestGoHome(mMom); } else if (mMom.SimDescription.AssignedRole != null) { mMom.SimDescription.AssignedRole.RemoveSimFromRole(); } Common.DebugNotify(msg); } if (mHourOfPregnancy > Aliens.Settings.mForeignLeaves) { msg += " - Walking Back 1 Hour"; mHourOfPregnancy--; Common.DebugNotify(msg); return; } } if (mHourOfPregnancy >= Aliens.Settings.mStartWalk) { ActiveTopic.AddToSim(mMom, "Pregnant", mMom.SimDescription); RequestPregnantWalkStyle(); } if (mHourOfPregnancy == Aliens.Settings.mStartLabor) { msg += " - Beginning Labor" + Common.NewLine; for (int i = 0; i < Aliens.Settings.mNumPuddles; i++) { PuddleManager.AddPuddle(mMom.PositionOnFloor); } if (mMom.IsSelectable) { StyledNotification.Show(new StyledNotification.Format(Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:BabyIsComingTNS", new object[] { mMom }), StyledNotification.NotificationStyle.kGameMessageNegative), "glb_tns_baby_coming_r2"); } mMom.BuffManager.RemoveElement(BuffsAndTraits.sXenogenesis); mMom.BuffManager.AddElement(BuffsAndTraits.sAlienBabyIsComing, Origin.FromPregnancy); if (mContractionBroadcast != null) { mContractionBroadcast.Dispose(); } mContractionBroadcast = new ReactionBroadcaster(mMom, kContractionBroadcasterParams, new ReactionBroadcaster.BroadcastCallback(StartReaction), new ReactionBroadcaster.BroadcastCallback(CancelReaction)); mMom.AddInteraction(TakeToHospitalEx.Singleton); InteractionInstance entry = HaveContraction.Singleton.CreateInstance(mMom, mMom, new InteractionPriority(InteractionPriorityLevel.High, 10f), false, false); mMom.InteractionQueue.Add(entry); mContractionsAlarm = mMom.AddAlarmRepeating(5f, TimeUnit.Minutes, new AlarmTimerCallback(TriggerContraction), 5f, TimeUnit.Minutes, "Trigger Contractions Alarm", AlarmType.AlwaysPersisted); EventTracker.SendEvent(EventTypeId.kPregnancyContractionsStarted, mMom); } if (mHourOfPregnancy >= Aliens.Settings.mPregnancyDuration) { msg += " - Delivering Baby" + Common.NewLine; HaveTheBaby(); } SetPregoBlendShape(); Common.DebugNotify(msg); }
protected override bool PrivateUpdate(ScenarioFrame frame) { Household house = Household.ActiveHousehold; Lot lot = house.LotHome; foreach (IThrowAwayable awayable in Sims3.Gameplay.Queries.GetObjects <IThrowAwayable>(lot)) { if (awayable == null) { continue; } if (awayable.InUse) { continue; } if (!awayable.HandToolAllowUserPickupBase()) { continue; } if (!awayable.ShouldBeThrownAway()) { continue; } if ((awayable.Parent != null) && (awayable.Parent.InUse)) { continue; } if (awayable is Bar.Glass) { continue; } if (awayable is Bill) { continue; } bool flag = false; if (awayable is BarTray) { foreach (Slot slot in awayable.GetContainmentSlots()) { if (awayable.GetContainedObject(slot) is Bar.Glass) { flag = true; break; } } } if (!flag) { awayable.ThrowAwayImmediately(); } } foreach (IDestroyOnMagicalCleanup destroyable in Sims3.Gameplay.Queries.GetObjects <IDestroyOnMagicalCleanup>(lot)) { GameObject obj = destroyable as GameObject; if (obj == null) { continue; } obj.FadeOut(false, true); } List <Fridge> fridges = new List <Fridge>(lot.GetObjects <Fridge>()); if (fridges.Count > 0) { Fridge fridge = fridges[0]; if ((fridge != null) && (house.SharedFridgeInventory != null) && (house.SharedFamilyInventory.Inventory != null)) { foreach (ServingContainer container in Sims3.Gameplay.Queries.GetObjects <ServingContainer>(lot)) { if ((!container.InUse) && (fridge.HandToolAllowDragDrop(container)) && (container.HasFood && container.HasFoodLeft()) && (!container.IsSpoiled && (container.GetQuality() >= Quality.Neutral))) { house.SharedFridgeInventory.Inventory.TryToAdd(container, false); } } } } foreach (Sim sim in HouseholdsEx.AllSims(house)) { if (!Inventories.VerifyInventory(sim.SimDescription)) { continue; } foreach (IThrowAwayable awayable2 in Inventories.QuickDuoFind <IThrowAwayable, GameObject>(sim.Inventory)) { if (awayable2 == null) { continue; } if (awayable2.InUse) { continue; } if (!awayable2.HandToolAllowUserPickupBase()) { continue; } if (!awayable2.ShouldBeThrownAway()) { continue; } if (awayable2.InUse) { continue; } if ((awayable2 is Newspaper) && !(awayable2 as Newspaper).IsOld) { continue; } if (awayable2 is TrashPileOpportunity) { continue; } if ((awayable2 is PreparedFood) && !(awayable2 as PreparedFood).IsSpoiled) { continue; } awayable2.ThrowAwayImmediately(); } } LotLocation[] puddles = World.GetPuddles(lot.LotId, LotLocation.Invalid); if (puddles.Length > 0x0) { foreach (LotLocation location in puddles) { if ((lot.TombRoomManager == null) || !lot.TombRoomManager.IsObjectInATombRoom(location)) { PuddleManager.RemovePuddle(lot.LotId, location); } } } try { List <Bill> allBills = new List <Bill>(); List <Bill> allBillsInMailboxes = new List <Bill>(); uint num = Bill.GetTotalAmountForAllBillsInHousehold(HouseholdsEx.AllSims(lot.Household)[0], allBills, allBillsInMailboxes); if (house.FamilyFunds >= num) { foreach (Bill bill in allBills) { if (!bill.InUse) { Money.AdjustFunds(house, "Bills", -(int)bill.Amount); bill.DestroyBill(true); } } } } catch (Exception e) { Common.DebugException(lot, e); } return(false); }
public override bool Run() { try { if (!StartSync()) { return(false); } bool flag2 = false; StandardEntry(false); BeginCommodityUpdates(); bool succeeded = false; try { if (IsMaster) { HotTubBase container = Actor.Posture.Container as HotTubBase; container.mSimsAreWooHooing = true; ReturnInstance.EnsureMaster(); mCurrentStateMachine = ReturnInstance.mCurrentStateMachine; IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;; string socialName = CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor); StartSocial(socialName); Actor.SocialComponent.StartSocializingWith(Target); Dictionary <Sim, SocialRule> effects = new Dictionary <Sim, SocialRule>(); SocialEffect = Actor.Conversation.UpdateOnSelectingInteraction(Actor, Target, Autonomous, CommonWoohoo.GetSocialName(definition.GetStyle(this), Actor), null, null, effects); Rejected = (SocialEffect == null) || (!SocialEffect.LHS.IsSocialAccepted()); InitiateSocialUI(Actor, Target); (LinkedInteractionInstance as NestedCuddleInteraction).Rejected = Rejected; if (Rejected) { mCurrentStateMachine.RequestState(null, "Woo Hoo Reject"); mCurrentStateMachine.RequestState(null, "ExitSitting"); FinishSocial(socialName, true); FinishSocialContext(); Actor.BuffManager.AddElement(BuffNames.WalkOfShame, Origin.FromRejectedWooHooOffHome); } else { if (CommonWoohoo.NeedPrivacy(false, Actor, Target)) { mSituation = new WooHoo.WooHooPrivacySituation(this); flag2 = !mSituation.Start(); } if (!flag2) { RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo); mCurrentStateMachine.AddOneShotScriptEventHandler(0x6e, OnAnimationEvent); mCurrentStateMachine.AddOneShotScriptEventHandler(0x6f, OnAnimationEvent); mCurrentStateMachine.AddOneShotScriptEventHandler(0x78, OnAnimationEvent); mCurrentStateMachine.AddOneShotScriptEventHandler(0x79, OnAnimationEvent); mCurrentStateMachine.AddOneShotScriptEventHandler(0x70, OnBabyCheck); mCurrentStateMachine.RequestState(null, "Woo Hoo Accept"); PuddleManager.AddPuddle(Actor.Posture.Container.Position); RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo); CommonWoohoo.RunPostWoohoo(Actor, Target, container, definition.GetStyle(this), definition.GetLocation(container), true); } FinishSocial(socialName, true); } } else { DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); } FinishLinkedInteraction(IsMaster); succeeded = !Rejected && !flag2; } finally { EndCommodityUpdates(succeeded); StandardExit(false, false); } if (Rejected) { InvokeDoResumeOnCleanup = false; } else if (!mPrivacyFailed) { Actor.SimDescription.SetFirstWooHoo(); } WaitForSyncComplete(); return(!Rejected); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
protected override bool PrivateUpdate(ScenarioFrame frame) { bool isActiveLot = false; if (Sim.ActiveActor != null) { isActiveLot = Lot.CanSimTreatAsHome(Sim.ActiveActor); if ((!isActiveLot) && (Household.ActiveHousehold.RealEstateManager != null)) { PropertyData data = Household.ActiveHousehold.RealEstateManager.FindProperty(Lot); if ((data != null) && (data.PropertyType == RealEstatePropertyType.Resort)) { isActiveLot = true; } } } if (GetValue <CleanOption, bool>()) { if ((!isActiveLot) && (!Lot.IsActive) && (!Occupation.DoesLotHaveAnyActiveJobs(Lot))) { bool cleaner = false; if ((Lot.Household != null) && (!Lot.IsBaseCampLotType)) { bool child = false; foreach (SimDescription sim in HouseholdsEx.All(Lot.Household)) { if (AddScoring("Neat", sim) > 0) { cleaner = true; } if (sim.ToddlerOrBelow) { child = true; } } if ((!child) && (Babysitter.Instance != null)) { Babysitter.Instance.MakeServiceRequest(Lot, false, ObjectGuid.InvalidObjectGuid); } } else { cleaner = true; // Disable all services applied to this lot Service[] serviceArray = new Service[] { Babysitter.Instance, Maid.Instance, PizzaDelivery.Instance, Repairman.Instance, SocialWorkerAdoption.Instance, Police.Instance }; foreach (Service service in serviceArray) { if (service == null) { continue; } service.MakeServiceRequest(Lot, false, ObjectGuid.InvalidObjectGuid); } } foreach (GameObject obj in Lot.GetObjects <GameObject>()) { if (obj.LotCurrent == null) { IncStat("Bogus Location " + obj.CatalogName + " (" + Lot.Name + ", " + Lot.Address + ")", Common.DebugLevel.High); continue; } if (obj is IVelvetRopes) { if (!Bartending.IsBarVenue(Lot)) { (obj as IVelvetRopes).NightlyCleanUp(); } } try { if (!Lot.DoesObjectNeedCleaning(obj)) { continue; } } catch (Exception e) { Common.Exception(obj, e); continue; } if (cleaner) { if (obj.IsCleanable) { obj.Cleanable.ForceClean(); } IThrowAwayable awayable = obj as IThrowAwayable; if (awayable != null) { awayable.ThrowAwayImmediately(); } Book book = obj as Book; if ((book != null) && (!(book.Data is BookToddlerData))) { if (!book.InInventory) { if (!Lots.PutAwayBook(this, book, Lot)) { if (!Lot.IsResidentialLot) { book.FadeOut(false, true); } } } } } if ((obj is IDestroyOnMagicalCleanup) && ((!Lot.IsResidentialLot) || (!sExpandedInstalled))) { obj.FadeOut(false, true); } } if (!Lot.IsResidentialLot) { Lot.FireManager.RestoreObjects(); } LotLocation[] puddles = World.GetPuddles(Lot.LotCurrent.LotId, LotLocation.Invalid); if (puddles.Length > 0) { foreach (LotLocation location in puddles) { PuddleManager.RemovePuddle(Lot.LotCurrent.LotId, location); } } LotLocation[] burntTiles = World.GetBurntTiles(Lot.LotCurrent.LotId, LotLocation.Invalid); if (burntTiles.Length > 0) { foreach (LotLocation location2 in burntTiles) { World.SetBurnt(Lot.LotId, location2, false); } } foreach (ICatPrey prey in Sims3.Gameplay.Queries.GetObjects <ICatPrey>(Lot)) { if (prey.IsUnconscious) { prey.Destroy(); } } if (!Lot.IsResidentialLot) { Lot.RepairAllObjects(); } } } if (GetValue <SeasonOption, bool>()) { if ((!isActiveLot) || (Lot.IsBaseCampLotType) || (Lot.HasVirtualResidentialSlots)) { SeasonalLotMarker[] objects = Lot.GetObjects <SeasonalLotMarker>(); if ((objects.Length > 0x0) && objects[0x0].IsKickNeeded()) { TimeUnit units = TimeUnit.Minutes; if (Lot.IsCommunityLot) { foreach (Sim sim in Lot.GetAllActors()) { Sim.MakeSimGoHome(sim, true, new InteractionPriority(InteractionPriorityLevel.High)); units = TimeUnit.Hours; } } Lot.mGoHomeForSeasonChangeTimer = Lot.AlarmManager.AddAlarm(1f, units, Lot.ChangeSeason, "timer just to make it yieldable", AlarmType.DeleteOnReset, Lot); Lot.AlarmManager.AlarmWillYield(Lot.mGoHomeForSeasonChangeTimer); } } else { Lot.MagicallyChangeSeason(); } } return(true); }
public override void HourlyCallback() { if (GameUtils.IsOnVacation() || GameUtils.IsUniversityWorld()) { Common.DebugNotify(mMom.FullName + Common.NewLine + "HumanSurrogatePregnancy.HourlyCallback" + Common.NewLine + " - Pregnancy Paused"); return; } mHourOfPregnancy++; string msg = mMom.FullName + Common.NewLine + "HumanSurrogatePregnancy.HourlyCallback" + Common.NewLine + " - Hour: " + mHourOfPregnancy + Common.NewLine; if (mHourOfPregnancy == kHourToStartPregnantMotives) { mMom.BuffManager.AddElement(BuffNames.Nauseous, Origin.FromUnknown); } if (mHourOfPregnancy < kHourToShowPregnantBuff && mHourOfPregnancy > kHourToStartPregnantMotives) { mMom.BuffManager.AddElement(BuffNames.Nauseous, Origin.FromUnknown); } if (mMom.Household.IsTouristHousehold) { msg += " - Foreign Sim" + Common.NewLine; ForeignVisitorsSituation foreignVisitorsSituation = ForeignVisitorsSituation.TryGetForeignVisitorsSituation(mMom); if (mHourOfPregnancy == kForeignSimDisplaysTNS && foreignVisitorsSituation != null) { StyledNotification.Show(new StyledNotification.Format(Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:ForeignBabyIsComingTNS", new object[] { mMom }), StyledNotification.NotificationStyle.kGameMessagePositive), "glb_tns_baby_coming_r2"); } if (mHourOfPregnancy == kForeignSimLeavesWorld) { if (foreignVisitorsSituation != null) { foreignVisitorsSituation.MakeGuestGoHome(mMom); } else if (mMom.SimDescription.AssignedRole != null) { mMom.SimDescription.AssignedRole.RemoveSimFromRole(); } } if (mHourOfPregnancy > kForeignSimLeavesWorld) { Common.DebugNotify(msg); mHourOfPregnancy--; return; } } if (mHourOfPregnancy == kHourToShowPregnantBuff) { msg += " - Adding Pregnant Buff" + Common.NewLine; Common.DebugNotify(msg); InteractionInstance interactionInstance = ShowPregnancyEx.Singleton.CreateInstance(mMom, mMom, new InteractionPriority(InteractionPriorityLevel.ESRB), false, false); interactionInstance.Hidden = true; mMom.InteractionQueue.AddNext(interactionInstance); return; } if (mHourOfPregnancy >= kHourToStartWalkingPregnant) { ActiveTopic.AddToSim(mMom, "Pregnant", mMom.SimDescription); RequestPregnantWalkStyle(); } if (mHourOfPregnancy == kHourToStartContractions) { msg += " - Starting Labor" + Common.NewLine; for (int i = 0; i < kNumberOfPuddlesForWaterBreak; i++) { PuddleManager.AddPuddle(mMom.PositionOnFloor); } if (mMom.IsSelectable) { StyledNotification.Show(new StyledNotification.Format(Localization.LocalizeString("Gameplay/ActorSystems/Pregnancy:BabyIsComingTNS", new object[] { mMom }), StyledNotification.NotificationStyle.kGameMessageNegative), "glb_tns_baby_coming_r2"); } mMom.BuffManager.RemoveElement(BuffNames.Pregnant); mMom.BuffManager.AddElement(BuffNames.BabyIsComing, Origin.FromPregnancy); if (mContractionBroadcast != null) { mContractionBroadcast.Dispose(); } mContractionBroadcast = new ReactionBroadcaster(mMom, kContractionBroadcasterParams, new ReactionBroadcaster.BroadcastCallback(StartReaction), new ReactionBroadcaster.BroadcastCallback(CancelReaction)); mMom.AddInteraction(TakeToHospital.Singleton); InteractionInstance entry = HaveContraction.Singleton.CreateInstance(mMom, mMom, new InteractionPriority(InteractionPriorityLevel.High, 10f), false, false); mMom.InteractionQueue.Add(entry); mContractionsAlarm = mMom.AddAlarmRepeating(5f, TimeUnit.Minutes, new AlarmTimerCallback(TriggerContraction), 5f, TimeUnit.Minutes, "Trigger Contractions Alarm", AlarmType.AlwaysPersisted); EventTracker.SendEvent(EventTypeId.kPregnancyContractionsStarted, mMom); } if (mHourOfPregnancy == kHoursOfPregnancy) { msg += " - Having the Baby"; HaveTheBaby(); } SetPregoBlendShape(); Common.DebugNotify(msg); }
public static void MagicallyCleanUp(Lot lot, bool bAlsoRepair) { foreach (GameObject obj2 in lot.FindAllObjectsToClean()) { if (!obj2.InUse) { if (obj2.IsCleanable) { obj2.Cleanable.ForceClean(); } IThrowAwayable awayable = obj2 as IThrowAwayable; if (awayable != null) { awayable.ThrowAwayImmediately(); } if (obj2 is Book) { Book book = obj2 as Book; if (book.MyShelf != null) { if (!book.InInventory) { book.MyShelf.Inventory.TryToAdd(book); } } else { Lot ownerLot = book.GetOwnerLot(); if (ownerLot == null) { ownerLot = lot; } List <Bookshelf> shelves = new List <Bookshelf> (ownerLot.GetObjects <Bookshelf> ()); if (shelves.Count > 0) { shelves[0].Inventory.TryToAdd(book); } else if (ownerLot.LotId == Sim.ActiveActor.LotHome.LotId) { Sim.ActiveActor.Household.SharedFamilyInventory.Inventory.TryToAdd(book); } else { book.FadeOut(false, true); } } } } } LotLocation[] puddles = World.GetPuddles(lot.LotCurrent.LotId, LotLocation.Invalid); if (puddles.Length > 0) { foreach (LotLocation location in puddles) { PuddleManager.RemovePuddle(lot.LotCurrent.LotId, location); } } LotLocation[] burntTiles = World.GetBurntTiles(lot.LotCurrent.LotId, LotLocation.Invalid); if (burntTiles.Length > 0) { foreach (LotLocation location2 in burntTiles) { World.SetBurnt(lot.LotId, location2, false); } } if (bAlsoRepair) { lot.RepairAllObjects(); } }