static NWorldFerry() { FieldInfo[] list; try { list = FindPersistableStatics(); } catch (Exception ex) { niec_native_func.OutputDebugString("NM: FindPersistableStatics() failed."); NiecException.SendTextExceptionToDebugger(ex); _mCargo = new Dictionary <FieldInfo, object>(); return; } if (list == null || list.Length == 0) { niec_native_func.OutputDebugString(string.Format("NM: There are no PersistableStatic fields declared in {0}.", typeof(T))); _mCargo = new Dictionary <FieldInfo, object>(); return; } _mCargo = new Dictionary <FieldInfo, object>(list.Length); foreach (FieldInfo field in list) { if (field == null) { //niec_native_func.OutputDebugString("NWorldFerry(): field == null. Should mono bug"); continue; } _mCargo[field] = null; } }
public static void CheckChangeInActiveHousehold(Household newHousehold, bool bForce) { if (newHousehold == null) { return; } if (sCurrentNonNullHousehold == null) { sCurrentNonNullHousehold = PlumbBob.sCurrentNonNullHousehold; PlumbBob.sCurrentNonNullHousehold = null; } try { if (sCurrentNonNullHousehold != newHousehold || bForce) { Lot lot = null; if (sCurrentNonNullHousehold != null) { lot = sCurrentNonNullHousehold.LotHome; } if (sCurrentNonNullHousehold != null && sCurrentNonNullHousehold != newHousehold) { Situation.OnActiveHouseholdChanged(sCurrentNonNullHousehold, newHousehold); if (!NiecHelperSituation.__acorewIsnstalled__) { Party.CancelAllHouseParties(sCurrentNonNullHousehold.LotHome); } //sCurrentNonNullHousehold.ResetSocialWorkerTrigger(); foreach (Sim allActor in sCurrentNonNullHousehold.AllActors) { try { allActor.OnBecameUnselectable(); } catch (Exception) { if (!NiecHelperSituation.__acorewIsnstalled__) { throw; } } } if (lot != null) { lot.OnBecameUnselected(); } sCurrentNonNullHousehold.ResetParentVacationsTrigger(); } if (newHousehold != null) { foreach (Sim actor in newHousehold.AllActors) { if (!Household.RoommateManager.IsNPCRoommate(actor)) { try { actor.OnBecameSelectable(); } catch (Exception) { if (!NiecHelperSituation.__acorewIsnstalled__) { throw; } } } } if (sCurrentNonNullHousehold != newHousehold) { if (lot != null) { //lot.TryTurnOffHolidayHouseLights(); } newHousehold.GiveIngredients(); } if (newHousehold.LotHome != null) { newHousehold.LotHome.OnBecameSelected(); } Lot.UpdatePlayerNeighbors(); TombRoomManager.OnChangeHousehold(newHousehold); try { if (sCurrentNonNullHousehold != newHousehold) { newHousehold.SetParentFreeVacationTrigger(false, false); } } catch (Exception) { if (!NiecHelperSituation.__acorewIsnstalled__) { throw; } } } EventTracker.SendEvent(new HouseholdUpdateEvent(EventTypeId.kHouseholdSelected, newHousehold)); } sCurrentNonNullHousehold = newHousehold; PlumbBob.sCurrentNonNullHousehold = newHousehold; } catch (Exception ex) { niec_native_func.OutputDebugString("CheckChangeInActiveHousehold(Household newHousehold, bool bForce) failed."); NiecException.SendTextExceptionToDebugger(ex); } }
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); }
/* * DebugString: "_NFixUp(): if (ListCollon.NullSimSimDescription == this)" * DebugString: "NMScript Exception Log * System.Exception: no message * #0: 0x0001f throw in Sims3.Gameplay.CAS.Sims3.Gameplay.CAS.SimDescription:Fixup () () #1: 0x00050 callvirt in NRaas.OverwatchSpace.Alarms.NRaas.OverwatchSpace.Alarms.RecoverMissingSims:PrivatePerformAction (bool) (9193E9C0 [0] ) #2: 0x00011 callvirt in NRaas.OverwatchSpace.Alarms.NRaas.OverwatchSpace.Alarms.AlarmOption:PerformAction (bool) (9193E9C0 [0] ) #3: 0x00002 call in NRaas.OverwatchSpace.Alarms.NRaas.OverwatchSpace.Alarms.AlarmOption:PerformAlarm () () #4: 0x0001b callvirt in NRaas.NRaas.Overwatch:OnTimer () () #5: 0x00000 in Sims3.Gameplay.Sims3.Gameplay.Function:Invoke () () #6: 0x00003 callvirt in NRaas.Common+FunctionTask:Simulate () () */ public void _NFixUp() { if (runI) { return; } if (ListCollon.NullSimSimDescription == this) { if (niec_native_func.cache_done_niecmod_native_debug_text_to_debugger) { niec_native_func.OutputDebugString("_NFixUp(): if (ListCollon.NullSimSimDescription == this)"); try { throw new Exception("no message"); } catch (Exception ex) { NiecException.SendTextExceptionToDebugger(ex); } } mIsValidDescription = false; NFinalizeDeath.SimDesc_NullToEmpty(this); mIsValidDescription = true; if (UnsafeFixNUllSimDESC) { var p = NFinalizeDeath.GetSafeSelectActor(); if (p != null && p.SimDescription != null) { mOutfits = p.SimDescription.Outfits; } if (!waitrunningtask01) { waitrunningtask01 = true; NiecTask.Perform(() => { for (int i = 0; i < 800; i++) { Simulator.Sleep(0); } waitrunningtask01 = false; NFinalizeDeath.SimDescCleanse(this, true, false); }); } } else if (!waitrunningtask01) { waitrunningtask01 = true; NiecTask.Perform(() => { for (int i = 0; i < 50; i++) { Simulator.Sleep(0); } waitrunningtask01 = false; NFinalizeDeath.SimDescCleanse(this, true, true); }); } return; } mIsValidDescription = true; if (base.TraitManager != null) { base.TraitManager.SetSimDescription(this); base.TraitManager.Fixup(); } if (CreatedSim != null && CreatedSim.Inventory != null) { foreach (TraitChip item in CreatedSim.Inventory.FindAll <TraitChip>(false)) { item.OnLoadFixup(); if (item.Owner == null) { item.SetOwner(this); } } } MiniSimDescription miniSimDescription = MiniSimDescription.Find(SimDescriptionId); if ((GameStates.IsTravelling || GameStates.IsEditingOtherTown) && miniSimDescription != null) { base.CASGenealogy = miniSimDescription.Genealogy; } if (GameObjectRelationships != null) { int i = 0; while (i < GameObjectRelationships.Count) { if (!Sims3.SimIFace.Objects.IsValid(GameObjectRelationships[i].GameObjectDescription.GameObject.ObjectId)) { GameObjectRelationships.RemoveAt(i); } else { i++; } } } if (mGenealogy == null) { mGenealogy = new Genealogy(this); } if (SkillManager == null) { SkillManager = new SkillManager(this); } else { SkillManager.OnLoadFixup(); } if (CareerManager == null) { CareerManager = new CareerManager(this); } else { CareerManager.OnLoadFixup(); } if (VisaManager == null) { VisaManager = new VisaManager(this); } else { VisaManager.OnLoadFixup(); } if (CelebrityManager == null) { CelebrityManager = new CelebrityManager(SimDescriptionId); } else if (CelebrityManager.Owner == null) { CelebrityManager.ResetOwnerSimDescription(SimDescriptionId); } if (LifeEventManager == null || !LifeEventManager.IsValid) { LifeEventManager = new LifeEventManager(this); } LifeEventManager.ClearInvalidActiveNodes(); if (OccultManager == null) { OccultManager = new OccultManager(this); } else { OccultManager.OnLoadFixup(); } if (IsPet) { if (PetManager == null) { PetManager = CreatePetManager(); } } else if (PetManager != null) { PetManager.Dispose(); PetManager = null; } if (IsEP11Bot) { if (TraitChipManager == null) { TraitChipManager = new TraitChipManager(this); } else if (TraitChipManager.Owner == null) { TraitChipManager.ResetOwnerSimDescription(SimDescriptionId); } TraitChipManager.OnLoadFixup(); } else if (TraitChipManager != null) { TraitChipManager.Dispose(); TraitChipManager = null; } AssignSchool(); if (mSimDescriptionId == 0) { MakeUniqueId(); } if (ReadBookDataList == null) { ReadBookDataList = new Dictionary <string, ReadBookData>(); } PushAgingEnabledToAgingManager(); if (mInitialShape.Owner == null || mCurrentShape.Owner == null || mInitialShape.Owner != this || mCurrentShape.Owner != this) { mInitialShape.Owner = (mCurrentShape.Owner = this); } if (OpportunityHistory == null) { OpportunityHistory = new OpportunityHistory(); } if (Sims3.Gameplay.Gameflow.sGameLoadedFromWorldFile && !Household.IsTravelImport && !GameStates.IsIdTravelling(SimDescriptionId)) { mDisplayedShape.Owner = mCurrentShape.Owner; mDisplayedShape.Fit = mCurrentShape.Fit; mDisplayedShape.Weight = mCurrentShape.Weight; mDisplayedShape.Pregnant = mCurrentShape.Pregnant; ResetLifetimeHappinessStatistics(); mHomeWorld = GameUtils.GetCurrentWorld(); } if (mHomeWorld == WorldName.Undefined) { mHomeWorld = GameUtils.GetCurrentWorld(); } if (RelicStats == null) { RelicStats = new RelicStatTracking(this); } RelicStats.SetSimDescription(this); if (TombStats == null) { TombStats = new TombStatTracking(this); } TombStats.SetSimDescription(this); if (Singing == null) { Singing = new SingingInfo(this); } Singing.SetSimDesctiption(this); if (AssignedRole != null) { AssignedRole.OnLoadFixUp(); } Lot lot = LotManager.GetLot(mVirtualLotId); if (lot != null) { lot.VirtualMoveIn(this); } if (Species == CASAgeGenderFlags.None) { Species = CASAgeGenderFlags.Human; } if (!CASLogic.GetSingleton().IsMusicTypeInstalled(FavoriteMusic)) { RandomizeFavoriteMusic(); } if (GetCurrentOutfits() != null) { OutfitCategories[] array = new OutfitCategories[5] { OutfitCategories.None, OutfitCategories.All, OutfitCategories.CategoryMask, OutfitCategories.PrimaryCategories, OutfitCategories.PrimaryHorseCategories }; foreach (var outfitCategories in array) { if (GetOutfitCount(outfitCategories) > 0) { RemoveOutfits(outfitCategories, false); if (base.mMaternityOutfits != null) { base.mMaternityOutfits.Remove(outfitCategories); } if (base.mOutfits != null) { base.mOutfits.Remove(outfitCategories); } } } } if (!GameUtils.IsInstalled(ProductVersion.EP4)) { Sim.PlayPretend.RemoveAllChildCostumeOutfits(this); if (CreatedSim != null && CreatedSim.CurrentOutfitCategory == OutfitCategories.ChildImagination) { CreatedSim.SwitchToOutfitWithoutSpin(OutfitCategories.Everyday); } RemoveOutfits(OutfitCategories.ChildImagination, true); base.Outfits.Remove(OutfitCategories.ChildImagination); if (SpoiledGiftHistory != null) { SpoiledGiftHistory.Clear(); SpoiledGiftHistory = null; } } if (CreatedSim != null && (OccultManager == null || !OccultManager.HasOccultType(OccultTypes.Vampire | OccultTypes.Genie | OccultTypes.Werewolf | OccultTypes.Ghost)) && mSkinToneKey.InstanceId == 15475186560318337848uL) { World.ObjectSetVisualOverride(CreatedSim.ObjectId, eVisualOverrideTypes.Genie, null); } }