protected override bool Run(SimDescription me, bool singleSelection) { if (!base.Run(me, singleSelection)) { return(false); } foreach (SelectionCriteria.Occult.Values type in mTypes) { if (type.mOccult == OccultTypes.Ghost) { Urnstone stone = Urnstones.FindGhostsGrave(me); if ((stone != null) && (me.CreatedSim != null)) { stone.GhostToSim(me.CreatedSim, false, false); } else { me.SetDeathStyle(SimDescription.DeathType.None, false); me.IsGhost = false; me.IsNeverSelectable = false; me.ShowSocialsOnSim = true; me.AgingEnabled = true; if (stone != null) { stone.Destroy(); } } } else { OccultTypeHelper.Remove(me, type.mOccult, true); } } return(true); }
public void Dispose(bool postLoad, bool isReset) { try { if (mWasFutureSim) { mSim.TraitManager.AddHiddenElement(TraitNames.FutureSim); } if (mSim.CreatedSim != null) { BuffManager buffManager = mSim.CreatedSim.BuffManager; if ((buffManager != null) && (mBuffs != null)) { foreach (BuffInstance buff in mBuffs) { buffManager.AddBuff(buff.Guid, buff.mEffectValue, buff.mTimeoutCount, buff.mTimeoutPaused, buff.mAxisEffected, buff.mBuffOrigin, false); } } if ((mInventory != null) && (mSim.CreatedSim.Inventory != null)) { Inventories.RestoreInventoryFromList(mSim.CreatedSim.Inventory, mInventory, true); } if (mDreamStore != null) { mDreamStore.Restore(mSim.CreatedSim); } if (mSafeStore != null) { mSafeStore.Dispose(); } if (mSim.DeathStyle != SimDescription.DeathType.None) { Urnstone stone = Urnstones.FindGhostsGrave(mSim); if (stone != null) { stone.GhostSetup(mSim.CreatedSim, true); } } mSim.CreatedSim.ReservedVehicle = mReservedVehicle; } } catch (Exception e) { Common.Exception(mSim, null, "Inventory", e); } // Must be after the opportunities are restored if ((mOpportunitiesChanged != null) && (OpportunityTrackerModel.gSingleton != null)) { OpportunityTrackerModel.gSingleton.OpportunitiesChanged = mOpportunitiesChanged; } try { if (!postLoad) { if ((mSim.CreatedSim != null) && (mSim.CreatedSim.OpportunityManager != null) && (mSim.CreatedSim.OpportunityManager.Count > 0)) { OpportunityTrackerModel.FireOpportunitiesChanged(); } } } catch (Exception e) { Common.Exception(mSim, null, "FireOpportunitiesChanged", e); } EventTracker.sCurrentlyUpdatingDreamsAndPromisesManagers = false; mSim.mGenealogy = mGenealogy; if (mDoll != null) { mDoll.mOwner = mSim; if (SimTypes.IsSelectable(mSim)) { try { mDoll.OnOwnerBecameSelectable(); } catch (Exception e) { Common.Exception(mSim, e); SimDescription sim = mDoll.GetLiveFormSimDescription(); if (sim != null) { new FixInvisibleTask(sim).AddToSimulator(); } } } } if ((mSim.CreatedSim != null) && (mSim.CreatedSim.Motives != null)) { if (mAcademicPerformance != -101) { mSim.CreatedSim.Motives.CreateMotive(CommodityKind.AcademicPerformance); Motive motive = mSim.CreatedSim.Motives.GetMotive(CommodityKind.AcademicPerformance); if (motive != null) { motive.Value = mAcademicPerformance; } } if (mUniversityStudy != -101) { mSim.CreatedSim.Motives.CreateMotive(CommodityKind.UniversityStudy); Motive motive = mSim.CreatedSim.Motives.GetMotive(CommodityKind.UniversityStudy); if (motive != null) { motive.Value = mUniversityStudy; } } } Relationships.RestoreRelations(mSim, mRelations); if ((mSim.TraitChipManager != null) && (mChips != null)) { for (int i = 0; i < mChips.Length; i++) { if (mChips[i] == null) { continue; } Common.StringBuilder name = new Common.StringBuilder(); try { name.Append(mChips[i].GetLocalizedName()); mSim.TraitChipManager.AddTraitChip(mChips[i], i); } catch (Exception e) { Common.Exception(mSim, null, name, e); } } } sChangingWorldsSuppression.Pop(); if ((mChangedHousehold != null) && (mChangedCallback != null)) { mChangedHousehold.HouseholdSimsChanged = mChangedCallback; } }