public static Sim DGSMakeRandomSimNoCheck(Vector3 point, CASAgeGenderFlags age, CASAgeGenderFlags gender, WorldName worldname) { LotLocation lotLocation = default(LotLocation); ulong lotLocation2 = World.GetLotLocation(point, ref lotLocation); Lot lot = LotManager.GetLot(lotLocation2); SimDescription simDescription2 = DGSMakeSSimDescription(age, gender, worldname, uint.MaxValue); Genetics.AssignRandomTraits(simDescription2); if (lot != null) { if (lot.Household == null) { Household household = Household.Create(); lot.MoveIn(household); } lot.Household.Add(simDescription2); } else { Household household2 = Household.Create(); household2.SetName(/* "E3Lesa is Good" */ "Good Household"); household2.Add(simDescription2); } WorldName currentWorld = worldname; simDescription2.FirstName = SimUtils.GetRandomGivenName(simDescription2.IsMale, currentWorld); simDescription2.LastName = SimUtils.GetRandomFamilyName(currentWorld); return(simDescription2.Instantiate(point)); }
public override void Perform(Sim sim, DiseaseVector vector) { int count = 0; List <GameObject> objs = sim.LotCurrent.GetObjectsInRoom <GameObject>(sim.RoomId); while ((count < mMaximum) && (objs.Count > 0)) { GameObject obj = RandomUtil.GetRandomObjectFromList(objs); count++; if (obj.GetFireType() == FireType.DoesNotBurn) { continue; } LotLocation loc = LotLocation.Invalid; ulong lotLocation = World.GetLotLocation(obj.PositionOnFloor, ref loc); if (!World.HasSolidFloor(obj.LotCurrent.mLotId, loc)) { continue; } if (lotLocation == 0x0L) { continue; } Sims3.Gameplay.Objects.Fire.CreateFire(lotLocation, loc); } }
public void UpdateInsideOutside() { Sim createdSim = mSimID.CreatedSim; if (createdSim == null) { return; } bool inRabbitHole = createdSim.SimInRabbitHolePosture; if (!inRabbitHole) { inRabbitHole = (createdSim.RoomId != 0); if (inRabbitHole && createdSim.IsSelectable) { Vector3 position = createdSim.Position; LotLocation invalid = LotLocation.Invalid; ulong lotLocationAtFloor = World.GetLotLocationAtFloor(position, ref invalid); if (World.HasPool(lotLocationAtFloor, invalid) && !World.HasAnyRoofAtPos(position)) { inRabbitHole = false; } } } BuffGermy.BuffInstanceGermy buffInstanceGermy = createdSim.BuffManager.GetElement(BuffNames.Germy) as BuffGermy.BuffInstanceGermy; if (buffInstanceGermy != null) { buffInstanceGermy.IsIndoors = inRabbitHole; } }
public override bool Run() { LotLocation val = default(LotLocation); ulong lotLocation = World.GetLotLocation(Hit.mPoint, ref val); Vector3 val2 = Hit.mPoint; if (!DrinkFromPondHelper.RouteToDrinkLocation(Hit.mPoint, Actor, Hit.mType, Hit.mId)) { return(false); } EWCatFishingSkill skill = Actor.SkillManager.GetSkill <EWCatFishingSkill>(EWCatFishingSkill.SkillNameID); if (skill == null) { skill = Actor.SkillManager.AddElement(EWCatFishingSkill.SkillNameID) as EWCatFishingSkill; } if (skill == null) { Show(new Format("Error: Attempt to add EWFishingSkill to " + Actor.Name + " FAILED.", NotificationStyle.kDebugAlert)); return(false); } skill.StartSkillGain(EWCatFishingSkill.kEWFishingSkillGainRateNormal); EnterStateMachine("Puddle", "Enter", "x"); BeginCommodityUpdates(); AnimateSim("Loop Play"); bool flag = DoLoop(ExitReason.Default, LoopDelegate, mCurrentStateMachine); EndCommodityUpdates(flag); AnimateSim("Exit"); skill.StopSkillGain(); return(flag); }
public static bool AddFire(Common.IStatGenerator stats, GameObject obj) { LotLocation loc = LotLocation.Invalid; ulong lotLocation = World.GetLotLocation(obj.PositionOnFloor, ref loc); if (!World.HasSolidFloor(obj.LotCurrent.mLotId, loc)) { stats.IncStat("No Solid Floor"); return(false); } if (lotLocation == 0x0L) { stats.IncStat("No Location"); return(false); } if (Sims3.Gameplay.Objects.Fire.CreateFire(lotLocation, loc) == null) { stats.IncStat("CreateFire Fail"); return(false); } return(true); }
protected static bool PrivateKill(Sim actor, Sim target, SimDescription.DeathType deathType) { GreyedOutTooltipCallback greyedOutTooltipCallback = null; if (!Assassination.CanBeKilled(target, ref greyedOutTooltipCallback)) { return(false); } if (deathType == SimDescription.DeathType.None) { new EraseKillTask(actor, target.SimDescription); return(true); } else { sStoryProgressionAboutToDie.Invoke <bool>(new object[] { target.SimDescription }); if (deathType == SimDescription.DeathType.Burn) { LotLocation location = LotLocation.Invalid; ulong lotLocation = World.GetLotLocation(target.PositionOnFloor, ref location); if (lotLocation != 0) { Fire.CreateFire(lotLocation, location); } } else if (deathType == SimDescription.DeathType.Meteor) { new MeteorControl(actor, target); return(true); } else if (deathType == SimDescription.DeathType.Thirst) { if (actor.SimDescription.IsVampire) { if (actor.TraitManager.HasElement(TraitNames.Vegetarian)) { actor.BuffManager.AddElement(BuffNames.Nauseous, Origin.FromCarnivorousBehavior); } else { actor.BuffManager.AddElement(BuffNames.Sated, Origin.FromReceivingVampireNutrients); } actor.Motives.SetMax(CommodityKind.VampireThirst); if (target.SimDescription.IsFairy) { actor.BuffManager.AddElement(BuffNames.DrankFromAFairy, Origin.FromReceivingVampireNutrients); } EventTracker.SendEvent(EventTypeId.kVampireDrankFromSim, actor, target); EventTracker.SendEvent(new VampireLifetimeEvent(EventTypeId.kVampireLifetimeEvent, actor.SimDescription, false, target.SimDescription.SimDescriptionId)); } } return(DelayedKill(actor, target, deathType)); } }
public override bool Run() { try { LotLocation location = LotLocation.Invalid; Lot lot = LotManager.GetLot(World.GetLotLocation(Destination, ref location)); if (lot != null) { if (Teleport.Perform(Actor, lot, true)) { return(true); } } return(base.Run()); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
protected bool OnPerform() { Vector3 positionOnFloor = Target.PositionOnFloor; LotLocation invalid = LotLocation.Invalid; ulong lotLocation = World.GetLotLocation(positionOnFloor, ref invalid); if ((lotLocation != 0L) && (Fire.CreateFire(lotLocation, invalid) != null)) { return(true); } return(false); }
public static Sim DGSMakeRandomSim(Vector3 point, CASAgeGenderFlags age, CASAgeGenderFlags gender, WorldName worldname) { LotLocation lotLocation = default(LotLocation); ulong lotLocation2 = World.GetLotLocation(point, ref lotLocation); Lot lot = LotManager.GetLot(lotLocation2); if ((age & (CASAgeGenderFlags.Baby | CASAgeGenderFlags.Toddler | CASAgeGenderFlags.Child)) != CASAgeGenderFlags.None) { bool flag = false; if (lot != null && lot.Household != null) { foreach (SimDescription simDescription in lot.Household.SimDescriptions) { if (simDescription.TeenOrAbove) { flag = true; break; } } } if (!flag) { return(null); } } SimDescription simDescription2 = DGSMakeSSimDescription(age, gender, worldname, uint.MaxValue); Genetics.AssignRandomTraits(simDescription2); if (lot != null) { if (lot.Household == null) { Household household = Household.Create(); household.Name = simDescription2.mLastName ?? ""; lot.MoveIn(household); } lot.Household.Add(simDescription2); } else { Household household2 = Household.Create(); household2.SetName(/* "E3Lesa is Good" */ "Good Household"); household2.Add(simDescription2); } WorldName currentWorld = worldname; simDescription2.FirstName = SimUtils.GetRandomGivenName(simDescription2.IsMale, currentWorld); simDescription2.LastName = SimUtils.GetRandomFamilyName(currentWorld); return(simDescription2.Instantiate(point)); }
public static Lot GetCameraTargetLot() { if (LotManager.sLots == null) { return(LotManager.sActiveLot ?? LotManager.sWorldLot); } LotLocation LotLocation = default(LotLocation); ulong Location = World.GetLotLocation(NFinalizeDeath.Fast_SnapToFloor(ScriptCore.CameraController.Camera_GetTarget()), ref LotLocation); Lot TargetLot = LotManager.GetLot(Location); if (TargetLot == null) { return(LotManager.sActiveLot ?? LotManager.sWorldLot); } return(TargetLot); }
public static Lot GetPostionTargetLot(Vector3 pos) { if (LotManager.sLots == null) { return(LotManager.GetWorldLot()); } LotLocation LotLocation = default(LotLocation); ulong Location = World.GetLotLocation(pos, ref LotLocation); Lot TargetLot = LotManager.GetLot(Location); if (TargetLot == null) { return(LotManager.GetWorldLot()); } return(TargetLot); }
public static void SpawnPuddles(Sprinkler sprinkler) { // this calls SetPuddles(true) in the core bool set = true; LotLocation location = new LotLocation(); ulong lotLocation = World.GetLotLocation(sprinkler.PositionOnFloor, ref location); int num2 = (int)(Math.Sqrt(2.0) * Sprinkler.kRangeOfSpray); Vector2[] vectorArray = new Vector2[4]; for (int i = 0; i <= 3; i++) { vectorArray[i].x = sprinkler.mDiscourageFootprintPoints[i].x; vectorArray[i].y = sprinkler.mDiscourageFootprintPoints[i].z; } Vector2 vector = new Vector2(vectorArray[1].x - vectorArray[0].x, vectorArray[1].y - vectorArray[0].y); Vector2 vector2 = new Vector2(vectorArray[3].x - vectorArray[0].x, vectorArray[3].y - vectorArray[0].y); float num4 = vector.Length(); vector.Normalize(); vector2.Normalize(); Vector3 worldPos = new Vector3(); Vector2 vector4 = new Vector2(); LotLocation location2 = new LotLocation(); short startingRoomId = World.GetRoomId(lotLocation, location, eRoomDefinition.LightBlocking); for (int j = location.mX - num2; j <= (location.mX + num2); j++) { for (int k = location.mZ - num2; k <= (location.mZ + num2); k++) { location2.mX = j; location2.mZ = k; location2.mLevel = location.mLevel; location2.mRoom = location.mRoom; World.GetWorldPosition(lotLocation, location2, ref worldPos); vector4.x = worldPos.x - vectorArray[0].x; vector4.y = worldPos.z - vectorArray[0].y; float num8 = (float)(vector4 * vector); float num9 = (float)(vector4 * vector2); if (((num8 >= 0f) && (num8 <= num4)) && ((num9 >= 0f) && (num9 <= num4))) { PlacePuddleIfSprayableEx(lotLocation, location2, worldPos, set, startingRoomId); } } } }
// Token: 0x0600A7E4 RID: 42980 RVA: 0x002FB840 File Offset: 0x002FA840 private void EventCallbackCreateAshPile(StateMachineClient sender, IEvent evt) { this.mAshPile = (GlobalFunctions.CreateObjectOutOfWorld("AshPile") as AshPile); if (this.Actor.SimDescription.IsMummy || this.Actor.SimDescription.DeathStyle == SimDescription.DeathType.MummyCurse) { this.mAshPile.SetMaterial("mummy"); } this.mAshPile.AddToWorld(); this.mAshPile.SetPosition(this.Actor.Position); this.mAshPile.SetTooltipText(this.Actor.SimDescription.FirstName + " " + this.Actor.SimDescription.LastName); LotLocation invalid = LotLocation.Invalid; World.GetLotLocation(this.mAshPile.Position, ref invalid); FireManager.BurnTile(this.mAshPile.LotCurrent.LotId, invalid); SimDescription.DeathType deathStyle = this.Actor.SimDescription.DeathStyle; float fadeTime = (deathStyle == SimDescription.DeathType.MummyCurse || deathStyle == SimDescription.DeathType.Thirst) ? 1.2f : GameObject.kGlobalObjectFadeTime; this.Actor.FadeOut(false, false, fadeTime); }
public static void SpawnPuddles(Sprinkler sprinkler) { // this calls SetPuddles(true) in the core bool set = true; LotLocation location = new LotLocation(); ulong lotLocation = World.GetLotLocation(sprinkler.PositionOnFloor, ref location); int num2 = (int)(Math.Sqrt(2.0) * Sprinkler.kRangeOfSpray); Vector2[] vectorArray = new Vector2[4]; for (int i = 0; i <= 3; i++) { vectorArray[i].x = sprinkler.mDiscourageFootprintPoints[i].x; vectorArray[i].y = sprinkler.mDiscourageFootprintPoints[i].z; } Vector2 vector = new Vector2(vectorArray[1].x - vectorArray[0].x, vectorArray[1].y - vectorArray[0].y); Vector2 vector2 = new Vector2(vectorArray[3].x - vectorArray[0].x, vectorArray[3].y - vectorArray[0].y); float num4 = vector.Length(); vector.Normalize(); vector2.Normalize(); Vector3 worldPos = new Vector3(); Vector2 vector4 = new Vector2(); LotLocation location2 = new LotLocation(); short startingRoomId = World.GetRoomId(lotLocation, location, eRoomDefinition.LightBlocking); for (int j = location.mX - num2; j <= (location.mX + num2); j++) { for (int k = location.mZ - num2; k <= (location.mZ + num2); k++) { location2.mX = j; location2.mZ = k; location2.mLevel = location.mLevel; location2.mRoom = location.mRoom; World.GetWorldPosition(lotLocation, location2, ref worldPos); vector4.x = worldPos.x - vectorArray[0].x; vector4.y = worldPos.z - vectorArray[0].y; float num8 = (float)(vector4 * vector); float num9 = (float)(vector4 * vector2); if (((num8 >= 0f) && (num8 <= num4)) && ((num9 >= 0f) && (num9 <= num4))) { PlacePuddleIfSprayableEx(lotLocation, location2, worldPos, set, startingRoomId); } } } }
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; } } } }
public static bool CanSkinnyDipAtLocation(Sim a, Vector3 position, ref GreyedOutTooltipCallback greyedOutTooltipCallback, bool okIfNoExistingSkinnyDippers, bool okIfAloneAndRomantic) { if (!GameUtils.IsInstalled(ProductVersion.EP3)) { return false; } if (a.Posture is CarryingChildPosture) { return false; } if (a.HasTrait(TraitNames.NeverNude) || a.HasTrait(TraitNames.Shy)) { return false; } if (Woohooer.Settings.mAllowTeenSkinnyDip) { if (a.SimDescription.ChildOrBelow) { return false; } } else { if (a.SimDescription.TeenOrBelow) { return false; } } /* if (a.SimDescription.IsVisuallyPregnant) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Common.LocalizeEAString(a.IsFemale, "Gameplay/Actors/Sim:PregnantFailure", new object[0x0])); return false; } */ if (!Pool.SimOutfitSupportsSkinnyDipping(a, ref greyedOutTooltipCallback)) { return false; } bool flag = okIfNoExistingSkinnyDippers; bool notRomantic = false; bool result = false; bool kidsAround = false; LotLocation location = new LotLocation(); ulong lotLocation = World.GetLotLocation(position, ref location); bool outside = World.IsPositionOutside(position); short mRoom = location.mRoom; List<Sim> lotSims = new List<Sim>(); if (Woohooer.Settings.mEnforceSkinnyDipPrivacy) { Lot lot = LotManager.GetLot(lotLocation); if ((lot != null) && (!lot.IsWorldLot)) { lotSims = new List<Sim>(lot.GetSims()); if (outside) { List<Sim> list2 = new List<Sim>(Sims3.Gameplay.Queries.GetObjects<Sim>(position, Pool.kRadiusToCheckForKids)); foreach (Sim sim in list2) { if (sim.LotCurrent == null) continue; if (sim.LotCurrent.LotId != lotLocation) { lotSims.Add(sim); } } } } } foreach (Sim sim2 in lotSims) { if (sim2 == a) continue; if (sim2.SimDescription.ToddlerOrBelow) continue; bool checkAge = false; if (Woohooer.Settings.mAllowTeenSkinnyDip) { if (sim2.SimDescription.ChildOrBelow) { checkAge = true; } } else { if (sim2.SimDescription.TeenOrBelow) { checkAge = true; } } if (checkAge) { if (sim2.LotCurrent == null) continue; if (sim2.LotCurrent.LotId == lotLocation) { kidsAround = true; } else if (outside && sim2.IsOutside) { kidsAround = true; } continue; } if (sim2.IsSkinnyDipping()) { flag = true; } if (okIfAloneAndRomantic && (sim2.RoomId == mRoom)) { notRomantic = notRomantic || !sim2.IsInRomanticRelationshipWith(a); } } if (flag) { result = true; } if ((a.HasTrait(TraitNames.Daredevil) || a.HasTrait(TraitNames.PartyAnimal)) || a.HasTrait(TraitNames.Inappropriate)) { result = true; } if (okIfAloneAndRomantic && !notRomantic) { result = true; } float hoursPassedOfDay = SimClock.HoursPassedOfDay; if ((hoursPassedOfDay <= (World.GetSunriseTime() + Pool.kTimeOffsetFromSunriseWhenCanGoSkinnyDip)) || (hoursPassedOfDay >= (World.GetSunsetTime() + Pool.kTimeOffsetFromSunsetWhenCanGoSkinnyDip))) { result = true; } if (result && kidsAround) { greyedOutTooltipCallback = new GrayedOutTooltipHelper(a.IsFemale, "KidsAroundTooltip", null).GetTooltip; return false; } return result; }
public static bool IsPointInLotSafelyRoutable(Sim ths, Lot lot, Vector3 pos) { if ((lot == null) || (lot.Corners == null)) { return(false); } if (pos.IsSimilarTo(Vector3.Zero) || pos.IsSimilarTo(Vector3.OutOfWorld)) { return(false); } LotLocation invalid = LotLocation.Invalid; ulong lotLocation = World.GetLotLocation(pos, ref invalid); if (!lot.IsWorldLot && (lotLocation != lot.LotId)) { return(false); } TerrainType terrainType = World.GetTerrainType(pos); switch (terrainType) { case TerrainType.WorldSea: case TerrainType.WorldPond: case TerrainType.LotPool: case TerrainType.LotPond: return(false); } if (!lot.IsWorldLot) { // Custom Route route = SimRoutingComponentEx.CreateRouteAsAdult(ths.SimRoutingComponent); route.SetOption(Route.RouteOption.EnableWaterPlanning, ths.IsHuman); float num2 = 1f; if (lot.IsHouseboatLot()) { num2++; } for (int i = 0x0; i < 0x4; i++) { RadialRangeDestination destination = new RadialRangeDestination(); destination.mCenterPoint = lot.Corners[i]; destination.mfMinRadius = 0f; destination.mfMaxRadius = num2; route.AddDestination(destination); destination = new RadialRangeDestination(); int num4 = (i + 0x1) % 0x4; destination.mCenterPoint = (Vector3)((lot.Corners[i] + lot.Corners[num4]) * 0.5f); destination.mfMinRadius = 0f; destination.mfMaxRadius = num2; route.AddDestination(destination); } route.PlanFromPoint(pos); if (route.PlanResult.mType != RoutePlanResultType.Succeeded) { return(false); } } return(true); }
protected override bool PrivateUpdate(ScenarioFrame frame) { List <GameObject> burnables = new List <GameObject>(); foreach (Lot lot in ManagerLot.GetOwnedLots(Target)) { foreach (GameObject obj in lot.GetObjects <GameObject>()) { if (obj == null) { continue; } if (obj.GetFireType() == FireType.DoesNotBurn) { continue; } if (string.IsNullOrEmpty(obj.CatalogName)) { continue; } if (obj is Sim) { continue; } if (obj is ICrib) { continue; } if (obj.InUse) { continue; } if (!obj.InWorld) { continue; } if (obj.LotCurrent == null) { continue; } LotLocation loc = LotLocation.Invalid; ulong lotLocation = World.GetLotLocation(obj.PositionOnFloor, ref loc); if (!World.HasSolidFloor(obj.LotCurrent.mLotId, loc)) { continue; } burnables.Add(obj); } } if (burnables.Count == 0) { IncStat("No Burnables"); return(false); } GameObject victim = RandomUtil.GetRandomObjectFromList(burnables); if (!Situations.PushVisit(this, Sim, Target.LotHome)) { IncStat("Push Fail"); return(false); } mFail = IsFail(Sim, Target); if (mFail) { int cost = (int)(victim.Value * 1.5); Money.AdjustFunds(Sim, "Damages", -cost); Money.AdjustFunds(Target, "Insurance", cost); } Manager.AddAlarm(new BurnScenario(Sim, Target, victim, this, mFail)); 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; } } } }
public override bool Run() { string msg = "Run"; checked { try { if (AcceptCancelDialog.Show("Force Select Actor?")) { msg = "Accept"; var definition = base.InteractionDefinition as Definition; LotLocation lotLocation = default(LotLocation); ulong lotLocation2 = World.GetLotLocation(this.Hit.mPoint, ref lotLocation); Lot lot = LotManager.GetLot(lotLocation2); if ((definition.Age & (CASAgeGenderFlags.Baby | CASAgeGenderFlags.Toddler | CASAgeGenderFlags.Child)) != CASAgeGenderFlags.None) { bool flag = false; if (lot != null && lot.Household != null) { foreach (SimDescription simDescription in lot.Household.SimDescriptions) { if (simDescription.TeenOrAbove) { flag = true; break; } } } if (!flag) { if (AssemblyCheckByNiec.IsInstalled("DGSCore") && TwoButtonDialog.Show("DGSCore" + NiecMod.Nra.NiecException.NewLine + "Found Childern Sims in Household Without Adult" + NiecMod.Nra.NiecException.NewLine + "Note: Social Worker Catch Remove Sims" + NiecMod.Nra.NiecException.NewLine + "Are you sure?!", "Yea It Create " + definition.Age, "No Create YoungAdult")) { msg = "Accept if not flag"; Sim simnocheck = DGSMakeRandomSimNoCheck(Hit.mPoint, definition.Age, definition.Gender, definition.WorldName); if (simnocheck != null) { if (simnocheck.IsSelectable) { PlumbBob.SelectActor(simnocheck); } else { simnocheck.SimDescription.IsNeverSelectable = false; PlumbBob.ForceSelectActor(simnocheck); } try { GlobalFunctions.PlaceAtGoodLocation(simnocheck, new World.FindGoodLocationParams(Hit.mPoint), false); if (simnocheck.SimDescription.TraitManager.HasElement(TraitNames.Evil)) { simnocheck.SimDescription.TraitManager.RemoveElement(TraitNames.Evil); simnocheck.SimDescription.TraitManager.AddElement(TraitNames.Good); } } catch { } try { if (simnocheck.SimDescription.Household.mName == null) { simnocheck.SimDescription.Household.SetName(simnocheck.SimDescription.LastName); } } catch (Exception ex2) { NiecMod.Nra.NiecException.WriteLog(msg + " SetName: " + NiecMod.Nra.NiecException.NewLine + NiecMod.Nra.NiecException.LogException(ex2), true, true); } } else { //return false; msg = "MakeSim Failed! if flag"; goto backif; } return(true); } backif: Sim sim = DGSMakeRandomSim(this.Hit.mPoint, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Male, definition.WorldName); msg = "Terraininstance"; if (sim != null) { Sitoat = true; mSima = sim; mSimaStat = sim.SimDescription; sim.FadeOut(); var terraininstance = new Terrain.TeleportMeHere.Definition(false).CreateInstance(Terrain.Singleton, sim, new InteractionPriority((InteractionPriorityLevel)8195), base.Autonomous, base.CancellableByPlayer) as TerrainInteraction; try { if (sim.SimDescription.TraitManager.HasElement(TraitNames.Evil)) { sim.SimDescription.TraitManager.RemoveElement(TraitNames.Evil); sim.SimDescription.TraitManager.AddElement(TraitNames.Good); } } catch { } if (terraininstance != null) { terraininstance.Hidden = true; terraininstance.MustRun = true; //Vector3 vector2; Lot loty = sim.SimDescription.LotHome; if (loty == null) { loty = sim.SimDescription.VirtualLotHome; } //World.FindGoodLocationParams fglParams = new World.FindGoodLocationParams(Helper.Create.GetPositionInRandomLot(loty)); /* * fglParams.BooleanConstraints |= FindGoodLocationBooleans.StayInRoom; * fglParams.InitialSearchDirection = RandomUtil.GetInt(0x0, 0x7); */ //lot.Household.Add(sim.SimDescription); terraininstance.Destination = Helpers.Create.GetPositionInRandomLot(loty); sim.InteractionQueue.Add(terraininstance); } } else { return(false); } try { //sim.SimDescription.Household.SetName(/* "E3Lesa is Good" */ "Good Household"); sim.SimDescription.Household.SetName(sim.SimDescription.LastName); } catch (Exception ex2) { NiecMod.Nra.NiecException.WriteLog(msg + " SetName: " + NiecMod.Nra.NiecException.NewLine + NiecMod.Nra.NiecException.LogException(ex2), true, true); } } } //lot.MoveIn(lot.Household); //FixFoxNonStaticDGSMakeRandomSim = true; Sim sim2 = DGSMakeRandomSim(this.Hit.mPoint, definition.Age, definition.Gender, definition.WorldName); if (sim2 != null) { PlumbBob.ForceSelectActor(sim2); if (mSima != null && Sitoat) { var followchildsim = Sims3.Gameplay.Actors.Sim.FollowParent.Singleton.CreateInstance(sim2, mSima, new InteractionPriority((InteractionPriorityLevel)8195), base.Autonomous, base.CancellableByPlayer) as Sims3.Gameplay.Actors.Sim.FollowParent; followchildsim.Hidden = true; followchildsim.MustRun = true; if (mSima.InteractionQueue.AddNextIfPossibleAfterCheckingForDuplicates(followchildsim)) { Sim.ForceSocial(mSima, sim2, "Chat", (InteractionPriorityLevel)8195, true); } //sim2.SimDescription.TraitManager.RemoveAllElements(); try { if (sim2.SimDescription.TraitManager.HasElement(TraitNames.Evil)) { sim2.SimDescription.TraitManager.RemoveElement(TraitNames.Evil); sim2.SimDescription.TraitManager.AddElement(TraitNames.Good); } } catch { } } } } else { msg = "Cancel"; var definition = base.InteractionDefinition as Definition; Sim sim3 = DGSMakeRandomSim(this.Hit.mPoint, definition.Age, definition.Gender, definition.WorldName); if (sim3 == null) { msg = "Sim3 is Null"; Sim sim4 = DGSMakeRandomSim(this.Hit.mPoint, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Male, definition.WorldName); if (sim4 != null) { msg = "Sim4 is Keep"; if (!sim4.IsInActiveHousehold) { try { if (sim4.SimDescription.Household.NameUnlocalized == "Good Household") { sim4.SimDescription.Household.SetName("Evil Household"); } else { sim4.SimDescription.Household.SetName(sim4.LastName); } sim4.SimDescription.TraitManager.RemoveAllElements(); sim4.SimDescription.TraitManager.AddElement(TraitNames.Daredevil); sim4.SimDescription.TraitManager.AddElement(TraitNames.Evil); sim4.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited); sim4.SimDescription.TraitManager.AddElement(TraitNames.Loser); sim4.SimDescription.TraitManager.AddElement(TraitNames.Adventurous); } catch { } } else { try { if (sim4.SimDescription.TraitManager.HasElement(TraitNames.Evil)) { sim4.SimDescription.TraitManager.RemoveElement(TraitNames.Evil); sim4.SimDescription.TraitManager.AddElement(TraitNames.Good); } } catch { } if (sim4.SimDescription.Household.NameUnlocalized == "Evil Household") { sim4.SimDescription.Household.SetName("Good Household"); } else { sim4.SimDescription.Household.SetName(sim4.LastName); } } Sim sim5 = DGSMakeRandomSim(this.Hit.mPoint, definition.Age, definition.Gender, definition.WorldName); if (sim5 != null) { msg = "Sim5 is Keep"; GlobalFunctions.PlaceAtGoodLocation(sim5, new World.FindGoodLocationParams(Hit.mPoint), false); if (!sim5.IsInActiveHousehold) { try { if (sim5.SimDescription.Household.NameUnlocalized == "Good Household") { sim5.SimDescription.Household.SetName("Evil Household"); } else { sim5.SimDescription.Household.SetName(sim5.LastName); } if (definition.Gender == CASAgeGenderFlags.Child) { sim5.SimDescription.TraitManager.RemoveAllElements(); sim5.SimDescription.TraitManager.AddElement(TraitNames.Evil); sim5.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited); sim5.SimDescription.TraitManager.AddElement(TraitNames.Loser); } else { sim5.SimDescription.TraitManager.RemoveAllElements(); sim5.SimDescription.TraitManager.AddElement(TraitNames.Daredevil); sim5.SimDescription.TraitManager.AddElement(TraitNames.Evil); sim5.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited); sim5.SimDescription.TraitManager.AddElement(TraitNames.Loser); sim5.SimDescription.TraitManager.AddElement(TraitNames.Adventurous); } } catch { } } else { try { if (sim5.SimDescription.TraitManager.HasElement(TraitNames.Evil)) { sim5.SimDescription.TraitManager.RemoveElement(TraitNames.Evil); sim5.SimDescription.TraitManager.AddElement(TraitNames.Good); } } catch { } if (sim5.SimDescription.Household.NameUnlocalized == "Evil Household") { sim5.SimDescription.Household.SetName("Good Household"); } else { sim5.SimDescription.Household.SetName(sim5.LastName); } } } else { return(false); } } else { return(false); } } else { if (!sim3.IsInActiveHousehold) { try { if (sim3.SimDescription.Household.NameUnlocalized == "Good Household") { sim3.SimDescription.Household.SetName("Evil Household"); } else { sim3.SimDescription.Household.SetName(sim3.LastName); } if (definition.Gender == CASAgeGenderFlags.Child) { sim3.SimDescription.TraitManager.RemoveAllElements(); sim3.SimDescription.TraitManager.AddElement(TraitNames.Evil); sim3.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited); sim3.SimDescription.TraitManager.AddElement(TraitNames.Loser); } else { sim3.SimDescription.TraitManager.RemoveAllElements(); sim3.SimDescription.TraitManager.AddElement(TraitNames.Daredevil); sim3.SimDescription.TraitManager.AddElement(TraitNames.Evil); sim3.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited); sim3.SimDescription.TraitManager.AddElement(TraitNames.Loser); sim3.SimDescription.TraitManager.AddElement(TraitNames.Adventurous); } } catch { } } else { try { if (sim3.SimDescription.TraitManager.HasElement(TraitNames.Evil)) { sim3.SimDescription.TraitManager.RemoveElement(TraitNames.Evil); sim3.SimDescription.TraitManager.AddElement(TraitNames.Good); } } catch { } if (sim3.SimDescription.Household.NameUnlocalized == "Evil Household") { sim3.SimDescription.Household.SetName("Good Household"); } } } } } catch (Exception ex) { NiecMod.Nra.NiecException.WriteLog(msg + " DGSMakeSim: " + NiecMod.Nra.NiecException.NewLine + NiecMod.Nra.NiecException.LogException(ex), true, true); return(false); } } return(true); }
public static bool CanSkinnyDipAtLocation(Sim a, Vector3 position, ref GreyedOutTooltipCallback greyedOutTooltipCallback, bool okIfNoExistingSkinnyDippers, bool okIfAloneAndRomantic) { if (!GameUtils.IsInstalled(ProductVersion.EP3)) { return(false); } if (a.Posture is CarryingChildPosture) { return(false); } if (a.HasTrait(TraitNames.NeverNude) || a.HasTrait(TraitNames.Shy)) { return(false); } if (Woohooer.Settings.mAllowTeenSkinnyDip) { if (a.SimDescription.ChildOrBelow) { return(false); } } else { if (a.SimDescription.TeenOrBelow) { return(false); } } /* * if (a.SimDescription.IsVisuallyPregnant) * { * greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Common.LocalizeEAString(a.IsFemale, "Gameplay/Actors/Sim:PregnantFailure", new object[0x0])); * * return false; * } */ if (!Pool.SimOutfitSupportsSkinnyDipping(a, ref greyedOutTooltipCallback)) { return(false); } bool flag = okIfNoExistingSkinnyDippers; bool notRomantic = false; bool result = false; bool kidsAround = false; LotLocation location = new LotLocation(); ulong lotLocation = World.GetLotLocation(position, ref location); bool outside = World.IsPositionOutside(position); short mRoom = location.mRoom; List <Sim> lotSims = new List <Sim>(); if (Woohooer.Settings.mEnforceSkinnyDipPrivacy) { Lot lot = LotManager.GetLot(lotLocation); if ((lot != null) && (!lot.IsWorldLot)) { lotSims = new List <Sim>(lot.GetSims()); if (outside) { List <Sim> list2 = new List <Sim>(Sims3.Gameplay.Queries.GetObjects <Sim>(position, Pool.kRadiusToCheckForKids)); foreach (Sim sim in list2) { if (sim.LotCurrent == null) { continue; } if (sim.LotCurrent.LotId != lotLocation) { lotSims.Add(sim); } } } } } foreach (Sim sim2 in lotSims) { if (sim2 == a) { continue; } if (sim2.SimDescription.ToddlerOrBelow) { continue; } bool checkAge = false; if (Woohooer.Settings.mAllowTeenSkinnyDip) { if (sim2.SimDescription.ChildOrBelow) { checkAge = true; } } else { if (sim2.SimDescription.TeenOrBelow) { checkAge = true; } } if (checkAge) { if (sim2.LotCurrent == null) { continue; } if (sim2.LotCurrent.LotId == lotLocation) { kidsAround = true; } else if (outside && sim2.IsOutside) { kidsAround = true; } continue; } if (sim2.IsSkinnyDipping()) { flag = true; } if (okIfAloneAndRomantic && (sim2.RoomId == mRoom)) { notRomantic = notRomantic || !sim2.IsInRomanticRelationshipWith(a); } } if (flag) { result = true; } if ((a.HasTrait(TraitNames.Daredevil) || a.HasTrait(TraitNames.PartyAnimal)) || a.HasTrait(TraitNames.Inappropriate)) { result = true; } if (okIfAloneAndRomantic && !notRomantic) { result = true; } float hoursPassedOfDay = SimClock.HoursPassedOfDay; if ((hoursPassedOfDay <= (World.GetSunriseTime() + Pool.kTimeOffsetFromSunriseWhenCanGoSkinnyDip)) || (hoursPassedOfDay >= (World.GetSunsetTime() + Pool.kTimeOffsetFromSunsetWhenCanGoSkinnyDip))) { result = true; } if (result && kidsAround) { greyedOutTooltipCallback = new GrayedOutTooltipHelper(a.IsFemale, "KidsAroundTooltip", null).GetTooltip; return(false); } return(result); }
private static void CheckAndUpdateRouteForPortals(Route r) { if (r.PlanResult.Succeeded()) { Sim target = r.Follower.Target as Sim; if (target != null) { // Subways and Ancient portals do not work for ghosts if (target.SimDescription.DeathStyle != SimDescription.DeathType.None) { return; } bool usingHoverTrain = target.CurrentInteraction is IHoverTrainStationInteraction; if (!usingHoverTrain) { if (Routes.Contains(r, PathType.VehiclePath)) { Vehicle ownedAndUsableVehicle = SimEx.GetOwnedAndUsableVehicle(target, target.LotCurrent); if (ownedAndUsableVehicle != null) { if (ownedAndUsableVehicle.DestroyOnRelease) { ownedAndUsableVehicle.Destroy(); ownedAndUsableVehicle = null; } return; } } } if (target.IsSelectable || RandomUtil.RandomChance01(SimRoutingComponent.kNPCSubwayUseChance) || usingHoverTrain) { bool found = false; for (uint i = 0; i < r.GetNumPaths(); i++) { PathData data = r.GetPathData(i); if (data.PathType != PathType.PortalPath) { continue; } AncientPortal portal = GameObject.GetObject <AncientPortal>(data.ObjectId); if (portal != null) { found = true; break; } else { IStation station = GameObject.GetObject <IStation>(data.ObjectId); if (station != null) { found = true; break; } } } if (found) { return; } LotLocation startLotLocation = LotLocation.Invalid; LotLocation endLotLocation = LotLocation.Invalid; Vector3 currentStartPoint = r.GetCurrentStartPoint(); Vector3 destPoint = r.GetDestPoint(); ulong startLot = World.GetLotLocation(currentStartPoint, ref startLotLocation); ulong endLot = World.GetLotLocation(destPoint, ref endLotLocation); if (((startLot != ulong.MaxValue) && (endLot != ulong.MaxValue)) && ((startLot != endLot) || (startLot == 0x0L))) { AncientPortal closestAP = null; float closestDistAP = float.MaxValue; AncientPortal destinationAP = null; float destDistanceAP = float.MaxValue; if (target.IsHuman) { foreach (AncientPortal choice in Sims3.Gameplay.Queries.GetObjects <AncientPortal>()) { Vector3 vector3 = choice.Position - currentStartPoint; if (vector3.Length() < closestDistAP) { closestDistAP = vector3.Length(); closestAP = choice; } Vector3 vector4 = choice.Position - destPoint; if (vector4.Length() < destDistanceAP) { destDistanceAP = vector4.Length(); destinationAP = choice; } } } IStation closestSW = null; float closestDistSW = float.MaxValue; IStation destinationSW = null; float destDistanceSW = float.MaxValue; foreach (IStation subway3 in Sims3.Gameplay.Queries.GetObjects <IStation>()) { Vector3 vector3 = subway3.Position - currentStartPoint; if (vector3.Length() < closestDistSW) { closestDistSW = vector3.Length(); closestSW = subway3; } Vector3 vector4 = subway3.Position - destPoint; if (vector4.Length() < destDistanceSW) { destDistanceSW = vector4.Length(); destinationSW = subway3; } } float distanceRemaining = r.GetDistanceRemaining(); float lengthAP = float.MaxValue; if (((closestAP != null) && (destinationAP != null)) && ((closestAP != destinationAP) && ((closestDistAP + destDistanceAP) <= (distanceRemaining + SimRoutingComponent.kDistanceMustSaveInOrderToUseSubway)))) { lengthAP = closestDistAP + destDistanceAP; } float lengthSW = float.MaxValue; if (((closestSW != null) && (destinationSW != null)) && ((closestSW != destinationSW) && ((closestDistSW + destDistanceSW) <= (distanceRemaining + SimRoutingComponent.kDistanceMustSaveInOrderToUseSubway)))) { lengthSW = closestDistSW + destDistanceSW; } if (lengthAP < lengthSW) { if (lengthAP != float.MaxValue) { Reroute(r, closestAP, destinationAP); } } else { if (lengthSW != float.MaxValue) { Reroute(r, closestSW, destinationSW); } } } } } } }
public static void ShouldBabyOrToddler(Sims3.Gameplay.ActorSystems.InteractionQueue simIQ) { if (simIQ.mBabyOrToddlerTransitionTargetInteraction != null) { return; } DaycareTransportSituation daycareTransportSituation = DaycareSituation.GetDaycareSituationForSim(simIQ.mActor) as DaycareTransportSituation; if (daycareTransportSituation != null) { return; } Sim sim = simIQ.mActor; InteractionInstance interactionInstance = simIQ.mInteractionList._items[0]; if (interactionInstance == null) { return; } Lot targetLot = interactionInstance.GetTargetLot(); LotLocation location = LotLocation.Invalid; World.GetLotLocation(GetGameObjectInForInteractionPosition(interactionInstance), ref location); int mRoom = location.mRoom; int mLevel = location.mLevel; if (interactionInstance.Target == simIQ.mActor || interactionInstance.Target == simIQ.mActor.Posture.Container) { return; } ItemComponent itemComp = interactionInstance.Target.ItemComp; if ((itemComp != null && itemComp.InventoryParent != null && itemComp.InventoryParent.Owner == sim) || simIQ.TryLocalToddlerCareRules(sim, interactionInstance, targetLot, mLevel, mRoom) || interactionInstance is Terrain.GoHereWith || (interactionInstance is Terrain.TeleportMeHere && !(interactionInstance is Terrain.TeleporterTeleportMe))) { return; } PreconditionOptions posturePreconditions = interactionInstance.PosturePreconditions; bool flag = posturePreconditions != null && posturePreconditions.ContainsPosture(CommodityKind.CarryingChild); Lot lotHome = sim.LotHome; bool flag2 = lotHome == sim.LotCurrent; if (flag2 && lotHome != null && lotHome.HasVirtualResidentialSlots) { flag2 = !sim.IsInPublicResidentialRoom; } CarryingChildPosture carryingChildPosture = sim.CarryingChildPosture; if (carryingChildPosture != null && carryingChildPosture.Child.Household == sim.Household && !flag2 && !flag) { if (simIQ.ShouldTakeBabyOrToddlerWithUsTo(interactionInstance)) { float num = (sim.Position - GetGameObjectInForInteractionPosition(interactionInstance)).LengthSqr(); float num2 = 0.99f / num; float num3 = 9.01f + num2 % num; if (!(num < num2) && !(num > num3)) { return; } Route route = sim.CreateRoute(); int[] validRooms = new int[1] { interactionInstance.Target.RoomId }; route.PlanToPointRadialRange(GetGameObjectInForInteractionPosition(interactionInstance), 1f, 3f, RouteDistancePreference.NoPreference, RouteOrientationPreference.NoPreference, targetLot.LotId, validRooms); if (route.PlanResult.Succeeded()) { float num4 = (route.GetDestPoint() - sim.Position).LengthSqr(); if (num4 >= 0.00250000018f) { Terrain.GoHere goHere = Terrain.GoHere.OtherLotWithCarriedChildSingleton.CreateInstance(Terrain.Singleton, sim, interactionInstance.GetPriority(), interactionInstance.Autonomous, true) as Terrain.GoHere; goHere.SetDestination(route.PlanResult.mDestination, false); simIQ.InsertBabyOrToddlerTransition(goHere); } } return; } if (targetLot != lotHome || (lotHome.HasVirtualResidentialSlots && sim.IsInPublicResidentialRoom && !targetLot.IsRoomPublic(mRoom))) { simIQ.InsertTakeBabyOrToddlerHome(sim, interactionInstance); return; } } if ((interactionInstance.Autonomous || CaregiverRoutingMonitor.TreatPlayerSimsLikeNPCs) && sim.SimDescription.TeenOrAbove && sim.Household != null && sim.Household.LotHome != null && sim.InheritedPriority().Level < InteractionPriorityLevel.ESRB) { bool flag3 = false; bool flag4 = false; if (targetLot == null || targetLot.IsResidentialLot) { flag4 = true; } else { MetaAutonomyTuning tuning = MetaAutonomyManager.GetTuning(interactionInstance.GetTargetLot().GetMetaAutonomyVenueType()); if (tuning != null) { flag3 = tuning.BabiesCanVisit; flag4 = tuning.ToddlersCanVisit; } } if (flag3 || flag4) { foreach (Sim sim2 in sim.Household.Sims) { if ((!sim2.SimDescription.Baby || sim2.LotCurrent != sim2.LotHome) && (!sim2.SimDescription.Baby || flag3) && (!sim2.SimDescription.Toddler || flag4) && sim2.SimDescription.ToddlerOrBelow && sim2.LotCurrent == sim.LotCurrent) { if (CaregiverRoutingMonitor.EnoughCaregiversRemain(sim.Household, sim.LotCurrent, false) || (carryingChildPosture != null && carryingChildPosture.Child.Household == sim.Household) || (!flag && flag2)) { break; } simIQ.InsertPickUpBabyOrToddler(sim, sim2, sim2.LotCurrent.IsActive || sim2.Posture.Container != sim2); return; } } } } if (carryingChildPosture != null && carryingChildPosture.Child.Household != sim.Household) { simIQ.InsertPutDownBabyOrToddler(sim); return; } if (carryingChildPosture != null) { DaycareSituation daycareSituationForChild = DaycareSituation.GetDaycareSituationForChild(carryingChildPosture.Child); if (daycareSituationForChild != null && daycareSituationForChild.Lot != interactionInstance.GetTargetLot()) { simIQ.InsertPutDownBabyOrToddler(sim); return; } } if ((interactionInstance.Autonomous || CaregiverRoutingMonitor.TreatPlayerSimsLikeNPCs) && carryingChildPosture != null && carryingChildPosture.Child.SimDescription.Baby && flag2 && targetLot != sim.LotCurrent) { simIQ.InsertPutDownBabyOrToddler(sim); } else if (sim.Household != null && sim.Household.LotHome != null) { foreach (Sim sim3 in sim.Household.Sims) { if (sim3.SimDescription.ToddlerOrBelow) { CaregiverRoutingMonitor.StartMonitoring(sim3); } } } }