public static bool SetActiveActor(Sim actor, bool force) { if (NiecHelperSituation.__acorewIsnstalled__) { if (!Instantiator.kDontCallDGSACore && NFinalizeDeath.RUNIACORE != null) { NFinalizeDeath.RUNIACORE(false); } else { NFinalizeDeath.CheckNHSP(); } } if (ShouldCheckTwoPlayer()) { return(false); } if (!force && actor != null && !actor.IsSelectable) { return(false); } if (NiecHelperSituation.__acorewIsnstalled__) { if (!Sims3.Gameplay.GameStates.IsGameShuttingDown && !force && actor == null) { return(false); } } try { throw new Exception("DEBUG SetActiveActor(Sim actor, bool force): " + (Type.GetType("Sims3.Gameplay.Core.PlumbBob") != null)); } catch (Exception ex) { NiecException.SendTextExceptionToDebugger(ex); } try { Sim sim = sCurrentSim; if (sim != null && sim.Inventory != null) { sim.Inventory.MuteMP3(); } if (actor != null && actor.Inventory != null) { actor.Inventory.UnmuteMP3(); } if (actor != null) { if (actor.Household != Household.ActiveHousehold) { actor.Household.MarkSimsAsProtected(); } PlumbBob splumbBob = PlumbBob.sSingleton; if (splumbBob != null) { if (NFinalizeDeath.World_IsEditInGameFromWBModeImpl()) { splumbBob.mSelectedActor = null; } else { splumbBob.mSelectedActor = actor; } } sCurrentSim = actor; bool okParentTo = false; if (actor.InWorld) { try { okParentTo = splumbBob != null && PlumbBob.ParentTo(actor); } catch (Exception) { } if (sim != actor) { if (actor.BuffManager != null) { BuffMummysCurse.BuffInstanceMummysCurse buffInstanceMummysCurse = actor.BuffManager.GetElement(BuffNames.MummysCurse) as BuffMummysCurse.BuffInstanceMummysCurse; if (buffInstanceMummysCurse != null) { BuffMummysCurse.SetCursedScreenFX(buffInstanceMummysCurse.CurseStage, false); } else { BuffMummysCurse.SetCursedScreenFX(0, false); } } if (actor.Household != null) { foreach (Sim itemSim in actor.Household.Sims) { if (itemSim == null) { continue; } Conversation conversation = itemSim.Conversation; if (conversation != null) { foreach (Sim member in conversation.Members) { if (member == null) { continue; } if (member != actor && member.ProgressMeter is CelebrityImpressProgressMeter) { ProgressMeter.HideProgressMeter(member, false); } } } } } if (actor.InteractionQueue != null) { InteractionInstance currentInteraction = NiecHelperSituation.__acorewIsnstalled__ ? NFinalizeDeath._GetCurrentInteraction(actor) : actor.InteractionQueue.GetCurrentInteraction(); if (currentInteraction is ICelebrityImpressInteraction) { CelebrityManager.ShowImpressProgressMeterIfNecessary(actor, currentInteraction.Target as Sim); } } } } if (splumbBob != null) { try { if (okParentTo) { World.AddObjectToScene(splumbBob.ObjectId); PlumbBob.ShowPlumbBob(); } else { PlumbBob.HidePlumbBob(); } } catch (Exception) { } } World.SetWallCutawayFocusPos(actor.Position); PlumbBob.CheckForChangeInActiveHousehold(actor.Household, force); PieMenu.ClearInteractions(); EventTracker.SendEvent(EventTypeId.kEventSimSelected, actor, sim); } else { PlumbBob splumbBob = PlumbBob.sSingleton; if (splumbBob != null) { splumbBob.mSelectedActor = null; } sCurrentSim = null; if (splumbBob != null) { try { PlumbBob.HidePlumbBob(); } catch (Exception) { } Slots.DetachFromSlot(splumbBob.ObjectId); if (splumbBob.LotCurrent != null) { splumbBob.LotCurrent.RemoveObjectFromLot(splumbBob.ObjectId, false); } } PlumbBob.CheckForChangeInActiveHousehold(null, force); PieMenu.ClearInteractions(); EventTracker.SendEvent(EventTypeId.kEventSimSelected, null, sim); } if (sim != actor && actor != null && actor.MoodManager != null) { actor.MoodManager.UpdatePlumbbobColor(); } } catch (Exception ex) // Should EA debug? { niec_native_func.OutputDebugString("SetActiveActor(Sim actor, bool force) failed."); if (actor != null) { var simDescription = actor.SimDescription; if (simDescription != null) { niec_native_func.OutputDebugString("Sim Name: " + simDescription.FullName); niec_native_func.OutputDebugString("Sim ID: " + simDescription.SimDescriptionId.ToString("X")); } } NiecException.SendTextExceptionToDebugger(ex); return(false); } return(true); }
public override void Startup() { Common.StringBuilder msg = new Common.StringBuilder("LiveModeStateEx:Startup" + Common.NewLine); Traveler.InsanityWriteLog(msg); try { UIManager.BlackBackground(false); msg += "A1"; Traveler.InsanityWriteLog(msg); // StateMachineState:Startup() mBaseCallFlag |= BaseCallFlag.kStartup; // InWorldSubState:Startup() while (sDelayNextStateStartupCount > 0x0) { SpeedTrap.Sleep(); } msg += "A2"; Traveler.InsanityWriteLog(msg); EventTracker.SendEvent(new InWorldSubStateEvent(this, true)); //base.Startup(); msg += "A3"; Traveler.InsanityWriteLog(msg); ShowUI(true); if (CameraController.IsMapViewModeEnabled() && !TutorialModel.Singleton.IsTutorialRunning()) { CameraController.EnableCameraMapView(true); } msg += "B"; Traveler.InsanityWriteLog(msg); CASExitLoadScreen.Close(); bool traveling = false; if (GameStates.IsTravelling) { if (GameStates.sTravelData == null) { GameStates.ClearTravelStatics(); } else { traveling = true; GameStatesEx.OnArrivalAtVacationWorld(); } } msg += "C"; Traveler.InsanityWriteLog(msg); if (GameStates.sNextSimToSelect != null) { DreamCatcher.SelectNoLotCheckImmediate(GameStates.sNextSimToSelect, true, true); GameStates.sNextSimToSelect = null; } msg += "D"; Traveler.InsanityWriteLog(msg); bool flag2 = false; if (LoadingScreenController.Instance != null) { if ((GameStates.IsPerfTestRunning || (CommandLine.FindSwitch("campos") != null)) || (CommandLine.FindSwitch("camtarget") != null)) { msg += "D1"; Traveler.InsanityWriteLog(msg); GameUtils.EnableSceneDraw(true); LoadingScreenController.Unload(); } else if (traveling) { msg += "D2"; Traveler.InsanityWriteLog(msg); uint customFlyThroughIndex = CameraController.GetCustomFlyThroughIndex(); if (GameStates.IsNewGame && (customFlyThroughIndex != 0x0)) { msg += "D3"; Traveler.InsanityWriteLog(msg); WaitForLotLoad(true, false); ShowUI(false); ShowMaptags(false); msg += "D4"; Traveler.InsanityWriteLog(msg); AudioManager.MusicMode = MusicMode.Flyby; CameraController.OnCameraFlyThroughFinishedCallback += OnCameraFlyThroughFinishedEvent; CameraController.StartFlyThrough(customFlyThroughIndex, false); flag2 = true; msg += "D5"; Traveler.InsanityWriteLog(msg); GameUtils.EnableSceneDraw(true); LoadingScreenController.Unload(); while (LoadingScreenController.Instance != null) { Sleep(0.0); } } else { msg += "D6"; Traveler.InsanityWriteLog(msg); WaitForLotLoad(true, true); Camera.SetView(CameraView.SimView, true, true); } } else { msg += "D7"; Traveler.InsanityWriteLog(msg); Camera.RestorePersistedState(); msg += "D8"; Traveler.InsanityWriteLog(msg); WaitForLotLoad(false, true); } } else if (traveling) { msg += "D9"; Traveler.InsanityWriteLog(msg); WaitForLotLoad(!GameUtils.IsUniversityWorld(), true); Camera.SetView(CameraView.SimView, true, true); } msg += "E"; Traveler.InsanityWriteLog(msg); UserToolUtils.UserToolGeneric(0xc8, new ResourceKey(0x0L, 0x0, 0x0)); if (!flag2) { GameUtils.Unpause(); } if (AudioManager.MusicMode != MusicMode.Flyby) { AudioManager.MusicMode = MusicMode.None; } msg += "F"; Traveler.InsanityWriteLog(msg); InWorldSubState.EdgeScrollCheck(); InWorldSubState.OpportunityDialogCheck(); try { DreamsAndPromisesManager.ValidateLifetimeWishes(); } catch (Exception e) { Common.Exception(msg, e); } LifeEventManager.ValidatePendingLifeEvents(); if (GameUtils.IsInstalled(ProductVersion.EP9)) { Tutorialette.TriggerLesson(Lessons.Degrees, Sim.ActiveActor); } if (GameUtils.GetCurrentWorldType() == WorldType.Base) { Tutorialette.TriggerLesson(Lessons.Traveling, Sim.ActiveActor); } if (Sims3.Gameplay.ActiveCareer.ActiveCareer.ActiveCareerShowGeneralLesson) { Tutorialette.TriggerLesson(Lessons.Professions, Sim.ActiveActor); } msg += "G"; Traveler.InsanityWriteLog(msg); Tutorialette.TriggerLesson(Lessons.AgingStageLengths, Sim.ActiveActor); Sim selectedActor = PlumbBob.SelectedActor; if (selectedActor != null) { // Custom if (GameStates.sMovingWorldData != null) { WorldData.MergeFromCrossWorldData(); } if (selectedActor.LotHome != null) { if (selectedActor.LotHome.HasVirtualResidentialSlots) { Tutorialette.TriggerLesson(Lessons.ApartmentLiving, selectedActor); } } else { Lot lot = Helpers.TravelUtilEx.FindLot(); if (lot != null) { lot.MoveIn(selectedActor.Household); foreach (SimDescription sim in Households.All(selectedActor.Household)) { if (sim.CreatedSim == null) { FixInvisibleTask.Perform(sim, false); } else { bool replace = (sim.CreatedSim == selectedActor); ResetSimTask.Perform(sim.CreatedSim, false); if (replace) { selectedActor = sim.CreatedSim; } } } msg += "MoveIn"; } } if (selectedActor.Household != null) { foreach (SimDescription description in Households.Humans(selectedActor.Household)) { // Custom if (GameStates.sMovingWorldData != null) { CrossWorldControl.Restore(description); } if (description.Child || description.Teen) { Tutorialette.TriggerLesson(Lessons.Pranks, null); break; } } } if (selectedActor.BuffManager != null) { BuffMummysCurse.BuffInstanceMummysCurse element = selectedActor.BuffManager.GetElement(BuffNames.MummysCurse) as BuffMummysCurse.BuffInstanceMummysCurse; if (element != null) { BuffMummysCurse.SetCursedScreenFX(element.CurseStage, false); } } if (selectedActor.CareerManager != null) { selectedActor.CareerManager.UpdateCareerUI(); } if (Traveler.Settings.mAllowSpawnWeatherStone && GameUtils.IsInstalled(ProductVersion.EP7) && GameUtils.IsInstalled(ProductVersion.EP8)) { Sims3.Gameplay.UI.Responder.Instance.TrySpawnWeatherStone(); } } msg += "H"; Traveler.InsanityWriteLog(msg); // Custom if (GameStates.sMovingWorldData != null) { GameStatesEx.UpdateMiniSims(GameStatesEx.GetAllSims()); foreach (SimDescription sim in Households.All(Household.ActiveHousehold)) { MiniSimDescription miniSim = MiniSimDescription.Find(sim.SimDescriptionId); if (miniSim != null) { miniSim.Instantiated = true; if (miniSim.HomeWorld != GameUtils.GetCurrentWorld()) { miniSim.HomeWorld = GameUtils.GetCurrentWorld(); } } if (sim.HomeWorld != GameUtils.GetCurrentWorld()) { sim.HomeWorld = GameUtils.GetCurrentWorld(); } } } GameStates.SetupPostMoveData(); GameStates.ClearMovingData(); MovingWorldsWizardCheck(); // Custom Household.IsTravelImport = false; InWorldSubStateEx.PlaceLotWizardCheck(this); msg += "I"; Traveler.InsanityWriteLog(msg); foreach (Sim sim in LotManager.Actors) { try { if (sim.HasBeenDestroyed) { continue; } OccultManager occultManager = sim.OccultManager; if (occultManager != null) { occultManager.RestoreOccultIfNecessary(); } } catch (Exception e) { Common.Exception(sim, null, msg, e); } } msg += "J"; Traveler.InsanityWriteLog(msg); // Custom foreach (SimDescription description in SimListing.GetResidents(false).Values) { if (description.LotHome == null) { continue; } MiniSimDescription miniSimDescription = description.GetMiniSimDescription(); if (miniSimDescription != null) { miniSimDescription.LotHomeId = description.LotHome.LotId; } } msg += "K"; Traveler.InsanityWriteLog(msg); } catch (Exception e) { Traveler.InsanityException(msg, e); } finally { CASExitLoadScreen.Close(); } }