public static bool RandomActiveHouseholdAndActiveActor() { if (GameStates.IsGameShuttingDown /* || Sims3.SimIFace.Environment.HasEditInGameModeSwitch */) { return(false); } List <Sim> list = new List <Sim>(); foreach (Sim actor in LotManager.Actors) { if (actor.SimDescription.CreatedSim != null && !actor.IsInActiveHousehold && actor.IsHuman && !actor.SimDescription.IsGhost && actor.SimDescription.Household != Household.NpcHousehold && actor.SimDescription.Household != Household.PetHousehold && actor.SimDescription.Household != Household.MermaidHousehold && actor.SimDescription.Household != Household.TouristHousehold && actor.SimDescription.Household != Household.PreviousTravelerHousehold && actor.SimDescription.Household != Household.AlienHousehold && actor.SimDescription.Household != Household.ServobotHousehold) { list.Add(actor); } } if (list.Count == 0) { return(false); } else if (list.Count > 0) { Sim randomObjectFromList = RandomUtil.GetRandomObjectFromList(list); if (!randomObjectFromList.InWorld) { randomObjectFromList.AddToWorld(); } PlumbBob.ForceSelectActor(randomObjectFromList); return(true); } return(false); }
public static void LoadActiveHousehold(ApartmentFamily activeFamily, Controller c) { try { //Clean the families first CleanupFamily(c); //Change active families int currentFunds = c.LotCurrent.Household.FamilyFunds; int currentUnpaidBills = c.LotCurrent.Household.UnpaidBills; //Handle the new active family first foreach (ApartmentFamily f in c.Families) { if (f.FamilyId == activeFamily.FamilyId) { f.IsActive = true; c.LotCurrent.Household.SetFamilyFunds(f.FamilyFunds); c.LotCurrent.Household.UnpaidBills = f.UnpaidBills; ApartmentController.SwitchActive(f, true); break; } } //Select the first sim in the active household if (activeFamily.Residents.Count > 0 && c.LotCurrent.Household.IsActive) { PlumbBob.ForceSelectActor(activeFamily.Residents[0].CreatedSim); } //Make everybody else roommates foreach (ApartmentFamily f in c.Families) { if (f.FamilyId != activeFamily.FamilyId) { //If this is the previous active family if (f.IsActive) { f.FamilyFunds = currentFunds; f.UnpaidBills = currentUnpaidBills; } f.IsActive = false; ApartmentController.SwitchActive(f, false); } } //Household.ActiveHousehold.mh // HudModel hudModel = Sims3.UI.Responder.Instance.HudModel as HudModel; } catch (Exception ex) { CommonMethods.PrintMessage("LoadActiveHousehold: " + ex.Message); } }
public static int OnMakeSim(object[] parameters) { try { Sim actor = Sim.MakeRandomSim(Service.GetPositionInRandomLot(LotManager.GetWorldLot()), CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Male); if (actor != null) { PlumbBob.ForceSelectActor(actor); } } catch (Exception e) { Common.Exception("OnMakeSim", e); } return(0); }
public static int OnSelectSim(object[] parameters) { try { List <Sim> sims = new List <Sim>(Sims3.Gameplay.Queries.GetObjects <Sim>()); if (sims.Count > 0) { PlumbBob.ForceSelectActor(sims[0]); } } catch (Exception e) { Common.Exception("OnSelectSim", e); } return(0); }
public override void ClickedOn(UIMouseEventArgs eventArgs) { Sim target = this.Target as Sim; if (((target == null) || (target.Household == null)) || (target.Household.LotHome == null)) { target = null; } if ((target != null) && (eventArgs.MouseKey == MouseKeys.kMouseRight) && (eventArgs.Modifiers == (Modifiers.kModifierMaskNone | Modifiers.kModifierMaskControl))) { PlumbBob.ForceSelectActor(target); } else { base.ClickedOn(eventArgs); } }
public static bool ActivateSimScreenMaskedFuncFromHousehold(PlayFlowModel ths, Household selectedHousehold, Lot selectedLot) { if ((selectedHousehold == null) || (selectedLot == null)) { return(false); } using (DreamCatcher.HouseholdStore store = new DreamCatcher.HouseholdStore(selectedHousehold, Mover.Settings.mDreamCatcher)) { Camera.SetMapViewActiveLotMode(true); LotManager.LockActiveLot(selectedLot); // Custom DreamCatcher.Task.PrepareToBecomeActiveHousehold(selectedHousehold); Sim sim = BinCommon.ActivateSim(selectedHousehold, selectedLot); if (sim == null) { sim = Households.AllSims(selectedHousehold)[0]; if (sim != null) { PlumbBob.ForceSelectActor(sim); } } LotManager.SetWallsViewMode(0x12e); selectedLot.SetDisplayLevel(selectedLot.DoesFoundationExistOnLot() ? 0x1 : 0x0); if (sim.LotCurrent == sim.LotHome) { Camera.FocusOnSelectedSim(); Camera.SetView(CameraView.SimView, false, false); } else { Camera.FocusOnLot(sim.LotHome.LotId, 0f); Camera.SetView(CameraView.HouseView, false, false); } } selectedLot.CheckIfLotNeedsBabysitter(); ths.Sleep(1.5); return(true); }
public static bool PerformImmediate(Sim sim, bool allowHouseholdSwitch, bool catchDreams, bool forceFull) { bool success = false; Common.StringBuilder msg = new Common.StringBuilder("DreamCatcher: " + sim.FullName + Common.NewLine); try { msg += "A"; if ((!forceFull) && (PlumbBob.sCurrentNonNullHousehold != null) && (PlumbBob.sCurrentNonNullHousehold == sim.Household)) { msg += "B"; if (PlumbBob.SelectedActor == sim) { return(true); } msg += "C"; using (SafeStore store = new SafeStore(sim.SimDescription, SafeStore.Flag.Selectable | SafeStore.Flag.Unselectable | SafeStore.Flag.StoreOpportunities)) { if (PlumbBob.SelectActor(sim)) { return(true); } msg += "C2"; return(false); } } msg += "D"; if (!allowHouseholdSwitch) { return(false); } msg += "E"; if (GameUtils.IsInstalled(ProductVersion.EP5)) { PetAdoption.RemoveNeighborAdoptionOnHousehold(sim.Household.LotHome); } if (sim.Posture == null) { sim.Posture = null; // Resets to Standing } using (HouseholdStore store = new HouseholdStore(sim.Household, catchDreams)) { if (sim.Household.LotHome != null) { PrepareToBecomeActiveHousehold(sim.Household); } foreach (SimDescription member in sim.Household.AllSimDescriptions) { if (member.GetMiniSimForProtection() == null) { MiniSimDescription miniSim; if (MiniSimDescription.sMiniSims.TryGetValue(member.SimDescriptionId, out miniSim)) { miniSim.mHomeWorld = WorldName.UserCreated; } } } Sim previousSim = Sim.ActiveActor; try { success = PlumbBob.ForceSelectActor(sim); } catch (Exception exception) { Common.Exception(sim, exception); if (previousSim != null) { PlumbBob.ForceSelectActor(previousSim); } } } msg += "F " + success; if ((MapTagManager.ActiveMapTagManager != null) && (sim.LotHome != null)) { MapTagManager.ActiveMapTagManager.Reset(); } } catch (Exception e) { Common.Exception(sim, e); } finally { //Common.DebugNotify(msg); } return(success); }
private static void AintAllDelDesc(bool loadworld) { try { if (NiecMod.KillNiec.AssemblyCheckByNiec.IsInstalled("DGSCore")) { //bool checkkillsimxxx = false; try { //Sleep(3.0); foreach (SimDescription sdtyf in NiecMod.Nra.NFinalizeDeath.TattoaX()) { try { if (!Sims3.NiecModList.Persistable.ListCollon.NiecSimDescriptions.Contains(sdtyf)) { Sims3.NiecModList.Persistable.ListCollon.NiecSimDescriptions.Add(sdtyf); } } catch { } } } catch { } //Sleep(3.0); try { CommandSystem.ExecuteCommandString("dgsunsafekill false"); } catch { } try { CommandSystem.ExecuteCommandString("dgspx false"); PlumbBob.ForceSelectActor(null); try { PlumbBob.sSingleton.mSelectedActor = null; } catch { } } catch { } try { List <MiniSimDescription> asdr = new List <MiniSimDescription>(MiniSimDescription.sMiniSims.Values); foreach (MiniSimDescription esdtyef in asdr) { try { if (esdtyef == null) { continue; } if (esdtyef.mProtectionFlags != null) { esdtyef.mProtectionFlags.Clear(); } esdtyef.Instantiated = false; esdtyef.mGenealogy = null; try { foreach (MiniRelationship miniRelationship in esdtyef.mMiniRelationships) { if (miniRelationship == null) { continue; } try { MiniSimDescription miniSimDescription2 = MiniSimDescription.Find(miniRelationship.SimDescriptionId); if (miniSimDescription2 != null) { if (miniSimDescription2.mProtectionFlags != null) { miniSimDescription2.mProtectionFlags.Clear(); } miniSimDescription2.Instantiated = false; miniSimDescription2.RemoveMiniRelatioship(esdtyef.mSimDescriptionId); miniSimDescription2.mGenealogy = null; } } catch { } } } catch { } if (esdtyef.mMiniRelationships != null) { esdtyef.mMiniRelationships.Clear(); } //MiniSimDescription.sMiniSims.Remove(esdtyef.mSimDescriptionId); } catch { } } } catch { } foreach (SimDescription sdtyef in Sims3.NiecModList.Persistable.ListCollon.NiecSimDescriptions) { try { if (sdtyef == null) { continue; } //sdtyef.RemoveOutfits(OutfitCategories.All, true); //sdtyef.RemoveOutfit(OutfitCategories.All, 0, true); if (!sdtyef.mIsValidDescription && !loadworld) { continue; } try { try { if (sdtyef.OccultManager != null) { sdtyef.OccultManager.RemoveAllOccultTypes(); } } catch { } sdtyef.OccultManager = null; } catch { } try { if (sdtyef.IsPregnant) { NRaas.CommonSpace.Helpers.CASParts.RemoveOutfits(sdtyef, OutfitCategories.All, false); } else { NRaas.CommonSpace.Helpers.CASParts.RemoveOutfits(sdtyef, OutfitCategories.All, true); } } catch { } sdtyef.Protected = false; MiniSimDescription inim = MiniSimDescription.Find(sdtyef.mSimDescriptionId); if (inim != null) { if (inim.mProtectionFlags != null) { inim.mProtectionFlags.Clear(); } inim.Instantiated = false; inim.mGenealogy = null; inim.ClearMiniRelationships(); } } catch { } try { Niec.iCommonSpace.KillPro.RemoveSimDescriptionRelationships(sdtyef); } catch { } try { Niec.iCommonSpace.KillPro.CleanseGenealogy(sdtyef); sdtyef.mGenealogy = null; } catch { } try { Niec.iCommonSpace.KillPro.RemoveSimDescriptionRelationships(sdtyef); } catch { } } List <Sim> asdo = new List <Sim>(); try { try { foreach (Sim simau in Sims3.Gameplay.Queries.GetObjects <Sim>()) { try { if (!asdo.Contains(simau)) { asdo.Add(simau); } } catch { } } foreach (Sim simau in LotManager.Actors) { try { if (!asdo.Contains(simau)) { asdo.Add(simau); } } catch { } } } catch { } try { foreach (Sim simaue in asdo) { try { NFinalizeDeath.ForceCancelAllInteractionsWithoutCleanup(simaue); } catch { } try { simaue.Genealogy.ClearAllGenealogyInformation(); } catch { } try { simaue.Genealogy.ClearMiniSimDescription(); } catch { } try { simaue.Destroy(); } catch { } try { (simaue as ScriptObject).Destroy(); } catch { } } } catch { } } catch { } finally { try { asdo.Clear(); } catch { } asdo = null; } foreach (SimDescription description in Sims3.NiecModList.Persistable.ListCollon.NiecSimDescriptions) { try { if (description == null) { continue; } if (!description.mIsValidDescription && !loadworld) { try { while (true) { Urnstone urnstone = null; urnstone = HelperNra.TFindGhostsGrave(description); if (urnstone != null) { urnstone.DeadSimsDescription = null; try { urnstone.Dispose(); } catch { } try { urnstone.Destroy(); } catch { } } else { break; } } } catch { } continue; } } catch { } try { if (description.IsPregnant) { NRaas.CommonSpace.Helpers.CASParts.RemoveOutfits(description, OutfitCategories.All, false); } else { NRaas.CommonSpace.Helpers.CASParts.RemoveOutfits(description, OutfitCategories.All, true); } } catch { } try { description.Genealogy.ClearMiniSimDescription(); } catch { } try { description.Genealogy.ClearDerivedData(); } catch { } try { description.Genealogy.ClearSimDescription(); } catch { } try { description.Genealogy.ClearAllGenealogyInformation(); } catch { } try { if (description.CreatedSim != null) { NFinalizeDeath.ForceCancelAllInteractionsWithoutCleanup(description.CreatedSim); } } catch { } try { Household household = description.Household; if (household != null) { household.Remove(description, !household.IsSpecialHousehold); } } catch { } try { while (true) { Urnstone urnstone = null; urnstone = HelperNra.TFindGhostsGrave(description); if (urnstone != null) { urnstone.DeadSimsDescription = null; try { urnstone.Dispose(); } catch { } try { urnstone.Destroy(); } catch { } } else { break; } } } catch { } try { MiniSimDescription.RemoveMSD(description.SimDescriptionId); } catch { } try { description.Dispose(); } catch { } /* * try * { * NRaas.CommonSpace.Helpers.Annihilation.Cleanse(description); * } * catch * { } */ description.mIsValidDescription = false; } try { //Sleep(3.0); foreach (Service allService in Services.AllServices) { try { if (!(allService is GrimReaper)) { allService.ClearServicePool(); } } catch { } } } catch { } try { //Sleep(3.0); foreach (Service allService in Services.AllServices) { try { if (!(allService is GrimReaper)) { Service.Destroy(allService); } } catch { } } } catch { } try { try { try { SimDescription.sLoadedSimDescriptions.Clear(); } catch { } SimDescription.sLoadedSimDescriptions = null; SimDescription.sLoadedSimDescriptions = new List <SimDescription>(); } catch { StyledNotification.Format afra = new StyledNotification.Format("Failed 1", StyledNotification.NotificationStyle.kSystemMessage); StyledNotification.Show(afra); } if (!loadworld) { try { Sims3.NiecModList.Persistable.ListCollon.NiecSimDescriptions.Clear(); Sims3.NiecModList.Persistable.ListCollon.NiecSimDescriptions = null; Sims3.NiecModList.Persistable.ListCollon.NiecSimDescriptions = new List <SimDescription>(); } catch { StyledNotification.Format afra = new StyledNotification.Format("Failed 2", StyledNotification.NotificationStyle.kSystemMessage); StyledNotification.Show(afra); } } try { MiniSimDescription.sMiniSims.Clear(); MiniSimDescription.sMiniSims = null; MiniSimDescription.sMiniSims = new Dictionary <ulong, MiniSimDescription>(); } catch { StyledNotification.Format afra = new StyledNotification.Format("Failed 3", StyledNotification.NotificationStyle.kSystemMessage); StyledNotification.Show(afra); } if (NiecMod.KillNiec.AssemblyCheckByNiec.IsInstalled("DGSCore")) { try { CommandSystem.ExecuteCommandString("dgsnocreate true"); StyledNotification.Format afra = new StyledNotification.Format("Termination Status: Perfect Execution!", StyledNotification.NotificationStyle.kGameMessageNegative); afra.mTNSCategory = NotificationManager.TNSCategory.Chatty; StyledNotification.Show(afra); } catch { } try { CommandSystem.ExecuteCommandString("dgsnocreate true"); } catch { } OptionsModel optionsModel = Sims3.Gameplay.UI.Responder.Instance.OptionsModel as OptionsModel; if (optionsModel != null) { optionsModel.SaveName = "ClearSave " + "No Name"; } try { GameStates.TransitionToEditTown(); } catch { } } } catch { } } } catch { } 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 override bool Run() // Run { if (Target.IsInActiveHousehold) { Target.Autonomy.IncrementAutonomyDisabled(); Target.SimDescription.AgingEnabled = false; try { Target.SimDescription.Gender = CASAgeGenderFlags.Female; } catch { } /* * try * { * * HelperNra helperNra = new HelperNra(); * * //helperNra = HelperNra; * * helperNra.mSimdesc = Target.SimDescription; * * * //helperNra.mSim = Target; * * AlarmManager.Global.AddAlarm(1f, TimeUnit.Hours, new AlarmTimerCallback(helperNra.ResetReset), "Helper Name " + Target.SimDescription.LastName, AlarmType.DeleteOnReset, null); * } * catch (Exception exception) * { NiecException.WriteLog("helperNra " + NiecException.NewLine + NiecException.LogException(exception), true, true, false); } */ PlumbBob.ForceSelectActor(Target); Target.ShowTNSIfSelectable("IGRS Violation: This Sim is on the world lot in " + Target.CurrentOutfitCategory + ". (" + Target.LogSuffix + ".) Contact Fullham Alfayet.", StyledNotification.NotificationStyle.kDebugAlert); //CameraController.TetherToObject(base.ObjectId); Sims3.Gameplay.Gameflow.SetGameSpeed(Sims3.SimIFace.Gameflow.GameSpeed.Pause, Sims3.Gameplay.Gameflow.SetGameSpeedContext.Gameplay); Target.RequestWalkStyle(Sim.WalkStyle.ForceRun); Target.SimDescription.AgingState.ResetAndExtendAgingStage(0f); Target.SimDescription.FirstName = ("You"); if (Target.IsFemale) { Target.SimDescription.LastName = ("Girl"); } else { Target.SimDescription.LastName = ("Boy"); } return(true); } else { SocialWorkerChildAbuse instance = SocialWorkerChildAbuse.Instance; if (instance != null) { instance.MakeServiceRequest(Target.LotHome, true, ObjectGuid.InvalidObjectGuid); } //SocialWorkerChildAbuse.Instance.MakeServiceRequest(Target.LotHome, true, ObjectGuid.InvalidObjectGuid); } return(true); }
public static bool CreateActiveHouseholdAndActiveActor() { if (GameStates.IsGameShuttingDown || PlumbBob.Singleton == null) { return(false); } if (/*PlumbBob.SelectedActor != null &&*/ PlumbBob.Singleton.mSelectedActor != null) { return(true); } List <Lot> lieast = new List <Lot>(); Lot lot = null; //foreach (object obj in LotManager.AllLotsWithoutCommonExceptions) foreach (object obj in LotManager.AllLots) { //Lot lot2 = (Lot)obj; //if (lot2.IsResidentialLot && lot2.Household == null) Lot lot2 = (Lot)obj; if (!lot2.IsWorldLot && !lot2.IsCommunityLotOfType(CommercialLotSubType.kEP10_Diving) && !UnchartedIslandMarker.IsUnchartedIsland(lot2) && lot2.IsResidentialLot && lot2.Household == null && !World.LotIsEmpty(lot2.LotId) && !lot2.IsLotEmptyFromObjects()) { lieast.Add(lot2); } if (lieast.Count == 0) { if (!lot2.IsWorldLot && !lot2.IsCommunityLotOfType(CommercialLotSubType.kEP10_Diving) && !UnchartedIslandMarker.IsUnchartedIsland(lot2) && lot2.IsResidentialLot && lot2.Household == null) { lieast.Add(lot2); } } } if (lieast.Count > 0) { string simlastnamehousehold = "No Name"; lot = RandomUtil.GetRandomObjectFromList <Lot>(lieast); List <Sim> siml = new List <Sim>(); Sim sim = null; Sim sim2 = null; Sim sim3 = null; Sim sim4 = null; if (AssemblyCheckByNiec.IsInstalled("DGSCore")) { try { CommandSystem.ExecuteCommandString("dgspx false"); } catch { } sim4 = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.Child, CASAgeGenderFlags.Female, GameUtils.GetCurrentWorld()); sim = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Male, WorldName.RiverView); sim2 = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Female, WorldName.IslaParadiso); sim3 = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.Child, CASAgeGenderFlags.Male, GameUtils.GetCurrentWorld()); } else { sim = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Male, GameUtils.GetCurrentWorld()); sim2 = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Female, GameUtils.GetCurrentWorld()); sim3 = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.Child, CASAgeGenderFlags.Male, GameUtils.GetCurrentWorld()); sim4 = DGSMakeSim.DGSMakeRandomSimNoCheck(lot.Position, CASAgeGenderFlags.Child, CASAgeGenderFlags.Female, GameUtils.GetCurrentWorld()); } if (sim != null) { simlastnamehousehold = sim.SimDescription.LastName; siml.Add(sim); } if (sim2 != null) { simlastnamehousehold = sim2.SimDescription.LastName; siml.Add(sim2); } if (sim3 != null) { siml.Add(sim3); } if (sim4 != null) { siml.Add(sim4); } try { Relationship relation = Relationship.Get(sim.SimDescription, sim2.SimDescription, true); if (relation != null) { NFinalizeDeath.ForceChangeState(relation, LongTermRelationshipTypes.Spouse); } /* * try * { * sim.Genealogy.RemoveDirectRelation(sim2.Genealogy); * sim2.Genealogy.RemoveDirectRelation(sim.Genealogy); * } * catch * { } * * * sim2.Genealogy.AddSibling(sim.Genealogy); */ } catch { } try { Relationship childfrined = Relationship.Get(sim3.SimDescription, sim4.SimDescription, true); if (childfrined != null) { NFinalizeDeath.ForceChangeState(childfrined, LongTermRelationshipTypes.GoodFriend); } Relationship relation2 = Relationship.Get(sim.SimDescription, sim3.SimDescription, true); if (relation2 != null) { NFinalizeDeath.ForceChangeState(relation2, LongTermRelationshipTypes.GoodFriend); } Relationship relation3 = Relationship.Get(sim.SimDescription, sim4.SimDescription, true); if (relation3 != null) { NFinalizeDeath.ForceChangeState(relation3, LongTermRelationshipTypes.GoodFriend); } Relationship relation4 = Relationship.Get(sim2.SimDescription, sim3.SimDescription, true); if (relation4 != null) { NFinalizeDeath.ForceChangeState(relation4, LongTermRelationshipTypes.GoodFriend); } Relationship relation5 = Relationship.Get(sim2.SimDescription, sim4.SimDescription, true); if (relation5 != null) { NFinalizeDeath.ForceChangeState(relation5, LongTermRelationshipTypes.GoodFriend); } Relationship relation6 = Relationship.Get(sim3.SimDescription, sim.SimDescription, true); if (relation6 != null) { NFinalizeDeath.ForceChangeState(relation6, LongTermRelationshipTypes.GoodFriend); } Relationship relation7 = Relationship.Get(sim3.SimDescription, sim2.SimDescription, true); if (relation7 != null) { NFinalizeDeath.ForceChangeState(relation7, LongTermRelationshipTypes.GoodFriend); } Relationship relation8 = Relationship.Get(sim4.SimDescription, sim.SimDescription, true); if (relation8 != null) { NFinalizeDeath.ForceChangeState(relation8, LongTermRelationshipTypes.GoodFriend); } Relationship relation9 = Relationship.Get(sim4.SimDescription, sim2.SimDescription, true); if (relation9 != null) { NFinalizeDeath.ForceChangeState(relation9, LongTermRelationshipTypes.GoodFriend); } } catch { } try { if (sim.SimDescription != null && sim.SimDescription.Genealogy != null) { sim.SimDescription.Genealogy.AddChild(sim3.SimDescription.Genealogy); } if (sim2.SimDescription != null && sim2.SimDescription.Genealogy != null) { sim2.SimDescription.Genealogy.AddChild(sim3.SimDescription.Genealogy); } } catch { } try { if (sim.SimDescription != null && sim.SimDescription.Genealogy != null) { sim.SimDescription.Genealogy.AddChild(sim4.SimDescription.Genealogy); } if (sim2.SimDescription != null && sim2.SimDescription.Genealogy != null) { sim2.SimDescription.Genealogy.AddChild(sim4.SimDescription.Genealogy); } } catch { } if (siml.Count > 0) { bool checknullsim = false; try { if (sim4 != null) { PlumbBob.ForceSelectActor(sim4); } else { checknullsim = true; } sim2.SimDescription.Household.SetName(sim2.SimDescription.LastName); } catch { } try { foreach (Sim sitem in siml) { if (sitem == null) { continue; } try { if (checknullsim) { PlumbBob.ForceSelectActor(sitem); checknullsim = false; } sitem.SimDescription.LastName = simlastnamehousehold; sitem.SimDescription.Household.SetName(sim.SimDescription.LastName); try { if (sitem.SimDescription.Child || sitem.SimDescription.Teen) { sitem.SimDescription.AssignSchool(); } GlobalFunctions.PlaceAtGoodLocation(sitem, new World.FindGoodLocationParams(lot.Position), false); } catch { } try { if (sitem.IsSelectable) { sitem.OnBecameSelectable(); } } catch { } } catch (Exception ex2) { NiecMod.Nra.NiecException.WriteLog("SetName Household" + " SetName: " + NiecMod.Nra.NiecException.NewLine + NiecMod.Nra.NiecException.LogException(ex2), true, true); } try { if (sitem.SimDescription.TraitManager.HasElement(TraitNames.Evil)) { sitem.SimDescription.TraitManager.RemoveElement(TraitNames.Evil); sitem.SimDescription.TraitManager.AddElement(TraitNames.Good); } sitem.AddInitialObjects(sitem.IsSelectable); } catch { } } } catch { } } } else if (lieast.Count == 0) { return(false); } return(true); }