public static string Perform(Household house, bool ignorePlaceholders) { if (house.LotHome == null) { return(null); } string msg = null; if (Households.NumSims(house) != Households.AllSims(house).Count) { List <SimDescription> sims = new List <SimDescription>(Households.All(house)); foreach (SimDescription description in sims) { bool flag = true; foreach (Sim sim in Households.AllSims(house)) { if (sim.SimDescription == description) { flag = false; break; } } if (flag) { FixInvisibleTask.Perform(description, false); msg += RecoverMissingSimTask.Perform(description, ignorePlaceholders); } } } return(msg); }
protected bool Allow(Lot lot) { if (lot.IsResidentialLot) { return(false); } else if (LotManager.ActiveLot == lot) { return(false); } else if (Household.ActiveHousehold == null) { return(false); } else if (Occupation.DoesLotHaveAnyActiveJobs(lot)) { Overwatch.Log("Active Job"); return(false); } else { foreach (Sim sim in Households.AllSims(Household.ActiveHousehold)) { if (sim.LotCurrent == lot) { Overwatch.Log("Active Sim"); return(false); } } } return(true); }
protected override OptionResult Run(GameHitParameters <GameObject> parameters) { Lot lot = parameters.mTarget as Lot; if (lot == null) { return(OptionResult.Failure); } if ((lot.Household.AllActors != null) && (lot.Household.AllActors.Count > 0)) { Sim sim = null; foreach (Sim member in Households.AllSims(lot.Household)) { if (member.SimDescription.IsNeverSelectable) { continue; } sim = member; break; } StoryProgression.Main.Sims.Select(sim); return(OptionResult.SuccessClose); } return(OptionResult.Failure); }
public override void PopulatePieMenuPicker(ref InteractionInstanceParameters parameters, out List <ObjectPicker.TabInfo> listObjs, out List <ObjectPicker.HeaderInfo> headers, out int NumSelectableRows) { if (GameUtils.IsFutureWorld()) { base.PopulatePieMenuPicker(ref parameters, out listObjs, out headers, out NumSelectableRows); } else { listObjs = null; headers = null; Sim actor = parameters.Actor as Sim; List <Sim> sims = new List <Sim>(); foreach (Sim sim2 in Households.AllSims(actor.Household)) { GreyedOutTooltipCallback callback = null; if (TravelerSpace.Helpers.TravelUtilEx.CanSimTriggerTravelToFutureWorld(sim2, true, ref callback)) { sims.Add(sim2); } } NumSelectableRows = sims.Count - 0x1; if (NumSelectableRows > 0x0) { base.PopulateSimPicker(ref parameters, out listObjs, out headers, sims, false); } } }
protected override bool Allow(GameHitParameters <GameObject> parameters) { Lot lot = parameters.mTarget as Lot; if (lot == null) { return(false); } if (lot.Household == null) { return(false); } if (lot.Household.IsActive) { return(false); } if (SimTypes.IsSpecial(lot.Household)) { return(false); } if (Households.AllSims(lot.Household).Count == 0) { return(false); } return(base.Allow(parameters)); }
protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log("Turn Off Televisions"); int count = 0; List <TV> televisions = new List <TV>(Sims3.Gameplay.Queries.GetObjects <TV>()); foreach (TV obj in televisions) { if ((!NRaas.Overwatch.Settings.mAffectActiveLot) && (Household.ActiveHousehold != null)) { if (obj.LotCurrent.Household == Household.ActiveHousehold) { continue; } bool found = false; foreach (Sim sim in Households.AllSims(Household.ActiveHousehold)) { if (sim.LotCurrent == obj.LotCurrent) { found = true; break; } } if (found) { continue; } } if (obj.TurnedOn) { try { obj.ClearStateInformation(); obj.TurnOff(); count++; } catch { obj.SetObjectToReset(); } } } if (count > 0) { Overwatch.AlarmNotify(Common.Localize("TurnOffTelevisions:Success", false, new object[] { count })); } } catch (Exception exception) { Common.Exception(Name, exception); } }
private static void OneDayPassedVacationUpdates(Household ths) { if (GameStates.CurrentDayOfTrip == GameStates.TripLength) { if (!GameStates.IsTravelling) { StyledNotification.Format format = new StyledNotification.Format(Common.LocalizeEAString("Gameplay/Vacation:OneDayLeft"), StyledNotification.NotificationStyle.kSystemMessage); StyledNotification.Show(format); } ths.mLastDayAlarm = AlarmManager.Global.AddAlarm(SimClock.HoursUntil(12f), TimeUnit.Hours, ths.HalfDayLeft, "Half Day left TNS", AlarmType.AlwaysPersisted, ths); } else if (GameStates.CurrentDayOfTrip > GameStates.TripLength) { bool denyTravel = false; if (!GameStates.IsTravelling) { foreach (Sim sim in Households.AllSims(ths)) { sim.VisaManager.UpdateDaysSpentInWorld(GameUtils.GetCurrentWorld(), GameStates.CurrentDayOfTrip - 0x1); if (sim.IsDying()) { denyTravel = true; } } } if (!denyTravel) { GameStates.StopSnappingPicturesIfNeccessary(); Sims3.Gameplay.UI.HudModel hudModel = Sims3.Gameplay.UI.Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel; if (hudModel != null) { WorldName currentWorld = GameUtils.GetCurrentWorld(); string str = hudModel.LocationName(currentWorld); SimpleMessageDialog.Show(TravelUtil.LocalizeString("TripOverCaption", new object[0x0]), TravelUtil.LocalizeString("TripOverText", new object[] { str }), ModalDialog.PauseMode.PauseSimulator); } } if (!denyTravel) { Traveler.SaveGame(); TravelUtil.PlayerMadeTravelRequest = true; // Calls custom function GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld(); } } }
public override bool Run() { try { if (mbEveryoneLeaves) { foreach (Sim sim in Households.AllSims(Household.ActiveHousehold)) { UpdateRomancesAndVisaManager(sim); } // Calls custom function Common.FunctionTask.Perform(GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld); return(true); } if ((mDepartingSims == null) || !IsValidEarlyDeparture()) { return(false); } Lot destinationLotForEarlyDepartureSims = GetDestinationLotForEarlyDepartureSims(); foreach (Sim sim2 in mDepartingSims) { UpdateRomancesAndVisaManager(sim2); GameStates.PerformEarlyDepartureToHomeWorld entry = GameStates.PerformEarlyDepartureToHomeWorld.Singleton.CreateInstance(sim2, sim2, new InteractionPriority(InteractionPriorityLevel.MaxDeath), false, false) as GameStates.PerformEarlyDepartureToHomeWorld; if (entry != null) { entry.DestinationLot = destinationLotForEarlyDepartureSims; sim2.InteractionQueue.Add(entry); } } return(true); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); } finally { TravelUtil.PlayerMadeTravelRequest = false; } return(false); }
protected override bool OnPerform() { if (Decensor.Settings.mDisable) { return(true); } List <Lot> lots = new List <Lot>(); Lot choice = LotManager.ActiveLot; if (choice != null) { lots.Add(choice); } choice = LotManager.GetLotAtPoint(CameraController.GetLODInterestPosition()); if ((choice != null) && (!lots.Contains(choice))) { lots.Add(choice); } if (Household.ActiveHousehold != null) { foreach (Sim sim in Households.AllSims(Household.ActiveHousehold)) { VerifyCensor(sim); } } foreach (Lot lot in lots) { if (lot.IsWorldLot) { continue; } foreach (Sim sim in lot.GetAllActors()) { VerifyCensor(sim); } } return(true); }
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); }
protected static void OnTimer() { try { if (Household.ActiveHousehold == null) { return; } foreach (Sim sim in Households.AllSims(Household.ActiveHousehold)) { ApplyBuff(sim); } } catch (Exception e) { Common.Exception("OnTimer", e); } }
protected static void CloseHouse(Household house) { if (house != null) { if (house == Household.ActiveHousehold) { return; } Dictionary <Lot, bool> lots = new Dictionary <Lot, bool>(); foreach (Sim sim in Households.AllSims(house)) { if (sim.LotCurrent == null) { continue; } if (!lots.ContainsKey(sim.LotCurrent)) { lots.Add(sim.LotCurrent, true); } } foreach (Lot lot in LotManager.AllLots) { if (lots.ContainsKey(lot)) { continue; } if (lot.IsResidentialLot) { house.RemoveGreetedLotForHousehold(lot, ObjectGuid.InvalidObjectGuid); } } } }
protected override OptionResult Run(GameHitParameters <GameObject> parameters) { Common.StringBuilder log = new Common.StringBuilder("Run"); try { Lot targetLot = Porter.GetLot(parameters.mTarget); if (targetLot == null) { return(OptionResult.Failure); } Dictionary <ulong, IMiniSimDescription> preExistingSims = SimListing.GetSims <IMiniSimDescription>(null, true); Household me = targetLot.Household; if (me == null) { me = GetImportSelection(targetLot); if (me == null) { return(OptionResult.Failure); } } Dictionary <ulong, IMiniSimDescription> allSims = SimListing.GetSims <IMiniSimDescription>(null, true); Dictionary <int, HouseData> houses = new Dictionary <int, HouseData>(); Dictionary <int, HouseData> doppleHouses = new Dictionary <int, HouseData>(); List <SimDescription> cleanUp = new List <SimDescription>(); List <SimDescription> fixUp = new List <SimDescription>(); List <Household> importedHouses = new List <Household>(); importedHouses.Add(me); List <SimDescription> checkSims = new List <SimDescription>(); log += Common.NewLine + "A"; List <SimDescription> sims = new List <SimDescription>(me.AllSimDescriptions); foreach (SimDescription sim in sims) { if (sim == null) { continue; } log += Common.NewLine + sim.FullName; Porter.AddExport(sim); string description = sim.mBio; if (string.IsNullOrEmpty(description)) { continue; } if (!description.Contains("NRaas.Porter:")) { continue; } description = description.Replace("NRaas.Porter:", ""); if (string.IsNullOrEmpty(description)) { continue; } HouseData lookup = new HouseData(description); lookup.Reconcile(sim); ValidateTask.Perform(sim); List <SimDescription> dependents = new List <SimDescription>(); if (HandleDoppleganger(sim, preExistingSims, allSims, dependents)) { if (!houses.ContainsKey(lookup.mID)) { if (!doppleHouses.ContainsKey(lookup.mID)) { doppleHouses.Add(lookup.mID, lookup); } } checkSims.AddRange(dependents); cleanUp.Add(sim); continue; } else { fixUp.Add(sim); } HouseData data; if (!houses.TryGetValue(lookup.mID, out data)) { data = lookup; houses.Add(data.mID, data); } doppleHouses.Remove(lookup.mID); data.mSims.Add(sim); } log += Common.NewLine + "B"; foreach (SimDescription sim in fixUp) { log += Common.NewLine + sim.FullName; new Relationships.RepairParents().Perform(sim, UnusedLog, allSims); new Relationships.RepairChildren().Perform(sim, UnusedLog, allSims); new Relationships.RepairSiblings().Perform(sim, UnusedLog, allSims); } log += Common.NewLine + "C"; foreach (SimDescription cleanup in cleanUp) { log += Common.NewLine + cleanup.FullName; try { if (cleanup.Household != null) { cleanup.Household.Remove(cleanup); } checkSims.Remove(cleanup); cleanup.Genealogy.ClearAllGenealogyInformation(); cleanup.Dispose(); } catch (Exception e) { Common.DebugException(log, e); } } log += Common.NewLine + "D"; if (houses.Count == 0) { SimpleMessageDialog.Show(Common.Localize("Title"), Common.Localize("Unpack:NotProper")); return(OptionResult.Failure); } else if (houses.Count == 1) { int funds = -1; foreach (HouseData data in houses.Values) { if (data.mID != 0) { funds = data.mFunds; } } if (funds >= 0) { me.SetFamilyFunds(funds); SimpleMessageDialog.Show(Common.Localize("Title"), Common.Localize("Unpack:Unneeded")); return(OptionResult.Failure); } } log += Common.NewLine + "E"; int unpacked = 0, failed = 0; List <HouseData> sorted = new List <HouseData>(houses.Values); sorted.Sort(new Comparison <HouseData>(HouseData.SortByCost)); foreach (HouseData data in sorted) { log += Common.NewLine + "House: " + data.mID; if (data.mID != 1) { Household house = null; if (data.mID != 0) { Lot lot = FindLot(data.mFunds, data.mSims); if (lot == null) { lot = FindLot(-1, null); if (lot == null) { failed++; continue; } } house = Household.Create(); importedHouses.Add(house); lot.MoveIn(house); house.Name = data.mName; int finalFunds = (data.mFunds - lot.Cost); if (finalFunds >= 0) { house.SetFamilyFunds(finalFunds); me.ModifyFamilyFunds(-data.mFunds); } else { house.SetFamilyFunds(0); me.ModifyFamilyFunds(-data.mFunds); me.ModifyFamilyFunds(finalFunds); } if (me.FamilyFunds < 0) { me.SetFamilyFunds(0); } if (house.FamilyFunds < 0) { house.SetFamilyFunds(0); } unpacked++; } foreach (SimDescription sim in data.mSims) { log += Common.NewLine + sim.FullName; if (house != null) { log += Common.NewLine + "Moved"; me.Remove(sim); house.Add(sim); Instantiation.Perform(sim, null); } else { log += Common.NewLine + "PlaceGrave"; Porter.PlaceGraveTask.Perform(sim); } } if (house != null) { string name = house.LotHome.Name; if (string.IsNullOrEmpty(name)) { name = house.LotHome.Address; } Porter.Notify(Common.Localize("Unpack:Success", false, new object[] { house.Name, name }), house.LotHome.ObjectId); } } else { unpacked++; } foreach (SimDescription sim in data.mSims) { sim.mBio = null; } } log += Common.NewLine + "F"; foreach (SimDescription checkSim in checkSims) { log += Common.NewLine + checkSim.FullName; if (checkSim.ChildOrBelow) { bool found = false; Household parentHousehold = null; foreach (SimDescription parent in Relationships.GetParents(checkSim)) { if ((checkSim.Household != null) && (parent.Household == checkSim.Household)) { found = true; break; } else { parentHousehold = parent.Household; } } if (!found) { if (parentHousehold == null) { if ((checkSim.Household != null) && (checkSim.Household.NumMembers == 1)) { foreach (Household house in Household.sHouseholdList) { foreach (SimDescription sim in Households.All(house)) { if (Relationships.IsCloselyRelated(checkSim, sim, false)) { parentHousehold = house; break; } } if (parentHousehold != null) { break; } } } } if (parentHousehold != null) { if (checkSim.Household != null) { checkSim.Household.Remove(checkSim); } parentHousehold.Add(checkSim); Instantiation.AttemptToPutInSafeLocation(checkSim.CreatedSim, false); } } } } log += Common.NewLine + "G"; foreach (Household house in importedHouses) { foreach (Sim sim in Households.AllSims(house)) { foreach (GameObject obj in Inventories.QuickFind <GameObject>(sim.Inventory)) { bool moveToFamily = false; if (!sim.Inventory.ValidForThisInventory(obj)) { moveToFamily = true; } else if (obj is IStageProp) { moveToFamily = true; } if (moveToFamily) { sim.Inventory.RemoveByForce(obj); Inventories.TryToMove(obj, house.SharedFamilyInventory.Inventory); } } } } log += Common.NewLine + "H"; int doppleFunds = 0; foreach (HouseData data in doppleHouses.Values) { doppleFunds += data.mFunds; } me.ModifyFamilyFunds(-doppleFunds); if (me.FamilyFunds < 0) { me.SetFamilyFunds(0); } SimpleMessageDialog.Show(Common.Localize("Title"), Common.Localize("Unpack:Completion", false, new object[] { unpacked, failed })); } catch (Exception e) { Common.Exception(log, e); } return(OptionResult.SuccessClose); }
public static bool TestAllow(InteractionDefinition definition, ref InteractionInstanceParameters parameters) { try { Common.StringBuilder msg = new Common.StringBuilder(); GreyedOutTooltipCallback greyedOutTooltipCallback = null; InteractionTestResult result = definition.Test(ref parameters, ref greyedOutTooltipCallback); if (!IUtil.IsPass(result)) { msg += Common.NewLine + result; sTracer.Reset(); sTracer.mActor = parameters.Actor as Sim; sTracer.mFail = true; sTracer.mIgnore = true; } else { sTracer.mActor = parameters.Actor as Sim; sTracer.Perform(); if ((sTracer.mActor != null) && (sTracer.mTestForActive)) { if (sTracer.mActor.IsSelectable) { if (GoHere.Settings.mDisallowActiveGoHome) { sTracer.mFail = true; } } else { if ((GoHere.Settings.mDisallowInactiveLeaveActiveLot) && (!sTracer.mActor.LotCurrent.IsBaseCampLotType) && (!sTracer.mActor.Autonomy.Motives.IsSleepy())) { foreach (Sim sim in Households.AllSims(Household.ActiveHousehold)) { if (sim.LotCurrent == sTracer.mActor.LotCurrent) { sTracer.mFail = true; break; } } } } } } if (((!sTracer.mIgnore) || (!GoHere.Settings.mIgnoreLogs)) && (Common.kDebugging)) { msg += Common.NewLine + sTracer.ToString(); Common.DebugException(parameters.Actor, parameters.Target, msg, new Exception()); } if (sTracer.mFail) { return(false); } } catch (Exception e) { Common.Exception(parameters.Actor, parameters.Target, e); } return(true); }
public static bool PublicTest(Sim actor, GameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if ((target.Repairable != null) && target.Repairable.Broken) { greyedOutTooltipCallback = Common.DebugTooltip("Broken"); return(false); } if (TravelUtil.PlayerMadeTravelRequest) { greyedOutTooltipCallback = Common.DebugTooltip("PlayerMadeTravelRequest"); return(false); } if (target.InUse && !target.IsActorUsingMe(actor)) { greyedOutTooltipCallback = Common.DebugTooltip("InUse"); return(false); } CauseEffectService instance = CauseEffectService.GetInstance(); if ((instance != null) && !instance.ShouldShowTimeAlmanacButton()) { greyedOutTooltipCallback = Common.DebugTooltip("ShouldShowTimeAlmanacButton"); return(false); } if (actor.BuffManager.HasElement(BuffNames.Ensorcelled)) { greyedOutTooltipCallback = Common.DebugTooltip("Ensorcelled"); return(false); } if (actor.Household.Sims.Count <= 0x1) { greyedOutTooltipCallback = Common.DebugTooltip("Single"); return(false); } // Custom if (!TravelerSpace.Helpers.TravelUtilEx.CanSimTriggerTravelToFutureWorld(actor, true, ref greyedOutTooltipCallback)) { return(false); } if (GameUtils.IsFutureWorld()) { foreach (Sim sim in Households.AllSims(actor.Household)) { // Custom if ((sim != actor) && !TravelerSpace.Helpers.TravelUtilEx.CanSimTriggerTravelToFutureWorld(sim, true, ref greyedOutTooltipCallback)) { //greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(actor.IsFemale, TimePortal.sLocalizationKey + ":UnfitForTravel", new object[] { actor })); return(false); } } } else { Common.StringBuilder result = new Common.StringBuilder(); List <Sim> list = new List <Sim>(); foreach (Sim sim2 in Households.AllSims(actor.Household)) { // Custom if ((sim2 != actor) && TravelerSpace.Helpers.TravelUtilEx.CanSimTriggerTravelToFutureWorld(sim2, true, ref greyedOutTooltipCallback)) { if (greyedOutTooltipCallback != null) { result += Common.NewLine + greyedOutTooltipCallback(); } list.Add(sim2); } } if (list.Count == 0x0) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(actor.IsFemale, TimePortal.sLocalizationKey + ":UnfitForTravel", new object[] { actor }) + Common.NewLine + result); return(false); } } return(true); }
protected override void PrivatePerformAction(bool prompt) { try { Overwatch.Log("Recover Stranded Toddlers"); string msg = null; List <Sim> sims = new List <Sim>(Sims3.Gameplay.Queries.GetObjects <Sim>()); foreach (Sim sim in sims) { if (sim.SimDescription == null) { continue; } if (!sim.SimDescription.ToddlerOrBelow) { continue; } if (sim.LotHome == null) { continue; } if (sim.LotCurrent == sim.LotHome) { continue; } if (sim.Posture is BeingCarriedPosture) { continue; } if (DaycareWorkdaySituation.GetDaycareWorkdaySituationForLot(sim.LotCurrent) != null) { continue; } bool guardian = false; foreach (Sim member in Households.AllSims(sim.Household)) { if ((member.SimDescription.TeenOrAbove) && (member.LotCurrent == sim.LotCurrent)) { guardian = true; break; } } if (guardian) { continue; } try { if (Instantiation.AttemptToPutInSafeLocation(sim, false)) { SpeedTrap.Sleep(); msg += Common.NewLine + sim.Name; } } catch { } } if (msg != null) { Overwatch.AlarmNotify(Common.Localize("RecoverStrandedToddlers:Success", false, new object[] { msg })); } } catch (Exception exception) { Common.Exception(Name, exception); } }
public static Sim Perform(Sim sim, bool fadeOut) { if (sim == null) { return(null); } try { SimDescription simDesc = sim.SimDescription; if (Simulator.GetProxy(sim.ObjectId) == null) { if (simDesc != null) { sim.Destroy(); } //sim.mSimDescription = null; return(null); } if (simDesc == null) { sim.mSimDescription = new SimDescription(); sim.Destroy(); return(null); } if (sim.LotHome != null) { simDesc.IsZombie = false; if (simDesc.CreatedSim != sim) { sim.Destroy(); simDesc.CreatedSim = null; return(null); } else { Bed myBed = null; BedData myBedData = null; foreach (Bed bed in sim.LotHome.GetObjects <Bed>()) { myBedData = bed.GetPartOwnedBy(sim); if (myBedData != null) { myBed = bed; break; } } ResetPosture(sim); if (simDesc.TraitManager == null) { simDesc.mTraitManager = new TraitManager(); } try { simDesc.Fixup(); Corrections.CleanupBrokenSkills(simDesc, null); ResetCareer(simDesc); simDesc.ClearSpecialFlags(); if (simDesc.Pregnancy == null) { try { if (simDesc.mMaternityOutfits == null) { simDesc.mMaternityOutfits = new OutfitCategoryMap(); } simDesc.SetPregnancy(0, false); simDesc.ClearMaternityOutfits(); } catch (Exception e) { Common.Exception(sim, null, "Pregnancy", e); } } if (sim.CurrentCommodityInteractionMap == null) { try { LotManager.PlaceObjectOnLot(sim, sim.ObjectId); if (sim.CurrentCommodityInteractionMap == null) { sim.ChangeCommodityInteractionMap(sim.LotHome.Map); } } catch (Exception e) { Common.Exception(sim, null, "ChangeCommodityInteractionMap", e); } } } catch (Exception e) { Common.Exception(sim, null, "Fixup", e); } ResetSituations(sim); CleanupSlots(sim); ResetInventory(sim); if (fadeOut) { bool active = (Sim.ActiveActor == sim); if (sSimReset.Valid) { sSimReset.Invoke <bool>(new object[] { simDesc.SimDescriptionId }); } ResetRouting(sim); using (CreationProtection protection = new CreationProtection(simDesc, sim, false, true, false)) { sim.Destroy(); Common.Sleep(); sim = FixInvisibleTask.InstantiateAtHome(simDesc, null); } if (sim != null) { if (active) { try { foreach (Sim member in Households.AllSims(sim.Household)) { if (member.CareerManager == null) { continue; } Occupation occupation = member.CareerManager.Occupation; if (occupation == null) { continue; } occupation.FormerBoss = null; } using (DreamCatcher.HouseholdStore store = new DreamCatcher.HouseholdStore(sim.Household, true)) { PlumbBob.DoSelectActor(sim, true); } } catch (Exception e) { Common.Exception(sim, null, "DoSelectActor", e); } } if ((myBed != null) && (myBedData != null)) { if (!(myBed is BedMultiPart) || (myBed is BedMultiPart && ((sim.Partner != null) && (sim.Partner.CreatedSim != null)))) { myBed.ClaimOwnership(sim, myBedData); } else { HandleDoubleBed(sim, myBed, myBedData); } } } } else { if (sim.Inventory == null) { sim.AddComponent <InventoryComponent>(new object[0x0]); } if (Instantiation.AttemptToPutInSafeLocation(sim, false)) { ResetRouting(sim); sim.SetObjectToReset(); // This is necessary to clear certain types of interactions // (it is also called in SetObjectToReset(), though doesn't always work there) if (sim.InteractionQueue != null) { sim.InteractionQueue.OnReset(); } } } ResetSkillModifiers(simDesc); ResetRole(sim); if (simDesc.IsEnrolledInBoardingSchool()) { simDesc.BoardingSchool.OnRemovedFromSchool(); } MiniSimDescription miniSim = MiniSimDescription.Find(simDesc.SimDescriptionId); if (miniSim != null) { miniSim.Instantiated = true; } UpdateInterface(sim); return(sim); } } else if (simDesc.Service is Butler) { if (Instantiation.AttemptToPutInSafeLocation(sim, true)) { sim.Motives.RecreateMotives(sim); sim.SetObjectToReset(); } return(sim); } else if (simDesc.IsImaginaryFriend) { OccultImaginaryFriend friend; if (OccultImaginaryFriend.TryGetOccultFromSim(sim, out friend)) { if (Simulator.GetProxy(friend.mDollId) != null) { friend.TurnBackIntoDoll(OccultImaginaryFriend.Destination.Owner); return(null); } } } else if (simDesc.IsBonehilda) { foreach (BonehildaCoffin coffin in Sims3.Gameplay.Queries.GetObjects <BonehildaCoffin>()) { if (coffin.mBonehilda == simDesc) { coffin.mBonehildaSim = null; break; } } } if (fadeOut) { sim.Destroy(); } return(null); } catch (Exception exception) { Common.Exception(sim, exception); return(sim); } }
protected new void TriggerTravelToVacationWorld() { RemoveTriggerAlarm(); List <Sim> allTravelers = new List <Sim>(Followers); allTravelers.Add(Actor); string reason = null; // Custom if ((TravelingSimGuids.Count == 0) || (Helpers.TravelUtilEx.FinalBoardingCall(Actor.Household, allTravelers, DestinationWorldName, false, ref reason))) { ForeignVisitorsSituation.ForceKillForeignVisitorsSituation(); HolographicProjectionSituation.ForceKillHolographicVisitorsSituation(); int lastTimeOnVacation = -2147483648; foreach (Sim sim in allTravelers) { if (lastTimeOnVacation < sim.VisaManager.LastTimeOnVacation) { lastTimeOnVacation = sim.VisaManager.LastTimeOnVacation; } } int numDaysSinceLastInDestWorld = -1; if (lastTimeOnVacation > 0) { numDaysSinceLastInDestWorld = SimClock.ElapsedCalendarDays() - lastTimeOnVacation; } Camera.SetView(CameraView.MapView, false, true); int tripLength = (TravelUtil.sOverriddenTripLength > 0x0) ? TravelUtil.sOverriddenTripLength : TravelDuration; // Custom GameStatesEx.TravelToVacationWorld(DestinationWorldName, TravelingSimGuids, tripLength, numDaysSinceLastInDestWorld); TelemetryStats.VacationTelemetryInfo vacationTelemetryInfo = new TelemetryStats.VacationTelemetryInfo(); vacationTelemetryInfo.LeavingHomeWorld = true; vacationTelemetryInfo.WorldId = DestinationWorldName; int num2 = 0x0; if (TravelingSimGuids.Count > 0) { vacationTelemetryInfo.NumberOfSimsInHoushold = Households.NumSims(Actor.Household); vacationTelemetryInfo.NumberOfSimsThatDidTravel = allTravelers.Count; foreach (Sim sim in Households.AllSims(Actor.Household)) { // Custom if (CommonSpace.Helpers.TravelUtilEx.CheckForReasonsToFailTravel(sim.SimDescription, Traveler.Settings.mTravelFilter, DestinationWorldName, false, false) == null) { num2++; } } } else { vacationTelemetryInfo.NumberOfSimsInHoushold = 0; vacationTelemetryInfo.NumberOfSimsThatDidTravel = 0; } vacationTelemetryInfo.NumberOfSimsAbleToTravel = num2; vacationTelemetryInfo.VisaLevels = new PairedListDictionary <ulong, int>(); foreach (Sim sim2 in allTravelers) { int visaLevel = sim2.VisaManager.GetVisaLevel(DestinationWorldName); vacationTelemetryInfo.VisaLevels.Add(sim2.SimDescription.SimDescriptionId, visaLevel); } vacationTelemetryInfo.TravelDateAndTime = SimClock.CurrentTime(); EventTracker.SendEvent(new VacationInfoEvent(EventTypeId.kVacationTelemetryInfo, vacationTelemetryInfo)); } else { if (DestinationWorldName == WorldName.FutureWorld) { Actor.ShowTNSIfSelectable(TravelUtil.LocalizeString(Actor.IsFemale, "CantTravelFutureTNS", new object[] { TravelCost }), StyledNotification.NotificationStyle.kSystemMessage, ObjectGuid.InvalidObjectGuid); } else { Actor.ShowTNSIfSelectable(TravelUtil.LocalizeString(Actor.IsFemale, "CantTravelTNS", new object[] { TravelCost }) + Common.NewLine + Common.NewLine + reason, StyledNotification.NotificationStyle.kSystemMessage, ObjectGuid.InvalidObjectGuid); } Actor.ModifyFunds(TravelCost); foreach (Sim sim3 in allTravelers) { if (!sim3.IsDying()) { sim3.AddExitReason(ExitReason.CanceledByScript); } } } }