コード例 #1
0
ファイル: Instantiator.cs プロジェクト: niec-and-linc/OpenDGS
        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;
        }
コード例 #2
0
ファイル: CleanseTheDead.cs プロジェクト: yakoder/NRaas
        public static bool Dispose(SimDescription sim, Logger log)
        {
            if (sim == null)
            {
                return(false);
            }

            Genealogy oldGene = sim.Genealogy;

            if (sim.CelebrityManager == null)
            {
                // If missing, the Dispose() fires a script error
                sim.CelebrityManager = new Sims3.Gameplay.CelebritySystem.CelebrityManager();
            }

            try
            {
                if (sim.Genealogy == null)
                {
                    MiniSimDescription miniSim = MiniSimDescription.Find(sim.SimDescriptionId);
                    if (miniSim != null)
                    {
                        sim.mGenealogy = miniSim.Genealogy;
                    }

                    if (sim.Genealogy == null)
                    {
                        sim.mGenealogy = new Genealogy(sim);
                    }
                }

                Urnstone stone = Urnstones.FindGhostsGrave(sim);
                if (stone != null)
                {
                    Inventory inventory = Inventories.ParentInventory(stone);
                    if (inventory != null)
                    {
                        inventory.RemoveByForce(stone);
                    }

                    try
                    {
                        stone.Dispose();
                        stone.Destroy();
                    }
                    catch (Exception e)
                    {
                        Common.Exception(sim, e);

                        if (inventory != null)
                        {
                            inventory.TryToAdd(stone, false);
                        }
                    }
                }
                else
                {
                    sim.Dispose(true, false, true);
                }

                if (log != null)
                {
                    log(" Disposed: " + sim.FullName);
                }

                return(true);
            }
            catch (Exception e)
            {
                Common.Exception(sim, e);
                return(false);
            }
            finally
            {
                // Reassign the genealogy, to compensate for an issue where the miniSim is reprocessed later
                sim.mGenealogy = oldGene;
            }
        }
コード例 #3
0
ファイル: Kill.cs プロジェクト: pepoluan/NRaas
            protected override void OnPerform()
            {
                int roomId = 0;
                Lot lot    = null;

                if (mTarget.CreatedSim != null)
                {
                    Vector3 location = mTarget.CreatedSim.PositionOnFloor;

                    lot    = mTarget.CreatedSim.LotCurrent;
                    roomId = mTarget.CreatedSim.RoomId;

                    List <GnomeData> gnomes = new List <GnomeData>();

                    if (mTarget.TraitManager.HasElement(TraitNames.CultureChina))
                    {
                        gnomes.Add(new GnomeData(0x000000000098977D, ProductVersion.EP1));
                    }
                    else if ((mTarget.TraitManager.HasElement(TraitNames.CultureEgypt)) || (mTarget.IsMummy))
                    {
                        gnomes.Add(new GnomeData(0x000000000098977C, ProductVersion.EP1));
                    }
                    else if (mTarget.TraitManager.HasElement(TraitNames.CultureFrance))
                    {
                        gnomes.Add(new GnomeData(0x000000000098977E, ProductVersion.EP1));
                    }
                    else if (mTarget.IsVampire)
                    {
                        gnomes.Add(new GnomeData(0x000000000098A1C2, ProductVersion.EP3));
                    }
                    else if (mTarget.IsFrankenstein)
                    {
                        gnomes.Add(new GnomeData(0x0000000000989CD9, ProductVersion.EP2));
                    }
                    else if ((mTarget.IsCelebrity) || (mTarget.AssignedRole is RolePaparazzi))
                    {
                        gnomes.Add(new GnomeData(0x000000000098A1C4, ProductVersion.EP3));
                    }
                    else if (mTarget.Occupation is MagicianCareer)
                    {
                        gnomes.Add(new GnomeData(0x000000000098D215, ProductVersion.EP6)); // Magician
                    }
                    else if (mTarget.Occupation is SingerCareer)
                    {
                        gnomes.Add(new GnomeData(0x000000000098D214, ProductVersion.EP6)); // Singer
                    }
                    else if (mTarget.IsCat)
                    {
                        gnomes.Add(new GnomeData(0x000000000098AAD6, ProductVersion.EP5)); // Pet Cat
                    }
                    else if (mTarget.IsADogSpecies)
                    {
                        gnomes.Add(new GnomeData(0x000000000098AAD5, ProductVersion.EP5)); // Pet Dog
                    }
                    else if (mTarget.IsHorse)
                    {
                        gnomes.Add(new GnomeData(0x000000000098AAD4, ProductVersion.EP5)); // Pet Horse
                    }
                    else
                    {
                        gnomes.Add(new GnomeData(0x000000000000058B, ProductVersion.BaseGame)); // Normal

                        if (GameUtils.IsInstalled(ProductVersion.EP1))
                        {
                            gnomes.Add(new GnomeData(0x000000000098977D, ProductVersion.EP1)); // China
                            gnomes.Add(new GnomeData(0x000000000098977C, ProductVersion.EP1)); // Egypt
                            gnomes.Add(new GnomeData(0x000000000098977E, ProductVersion.EP1)); // France
                        }

                        if (GameUtils.IsInstalled(ProductVersion.EP2))
                        {
                            gnomes.Add(new GnomeData(0x0000000000989EEC, ProductVersion.EP2)); // Caveman
                            gnomes.Add(new GnomeData(0x0000000000989CD9, ProductVersion.EP2)); // Inventor
                            gnomes.Add(new GnomeData(0x0000000000989EDF, ProductVersion.EP2)); // Laundry
                            gnomes.Add(new GnomeData(0x0000000000989CF2, ProductVersion.EP2)); // Sculptor
                        }

                        if (GameUtils.IsInstalled(ProductVersion.EP3))
                        {
                            gnomes.Add(new GnomeData(0x000000000098A1C4, ProductVersion.EP3)); // Celebrity
                            gnomes.Add(new GnomeData(0x000000000098A1C2, ProductVersion.EP3)); // Vampire
                        }

                        if (GameUtils.IsInstalled(ProductVersion.EP5))
                        {
                            gnomes.Add(new GnomeData(0x000000000098AEB1, ProductVersion.EP5)); // Freezer Bunny
                            gnomes.Add(new GnomeData(0x000000000098AAD6, ProductVersion.EP5)); // Pet Cat
                            gnomes.Add(new GnomeData(0x000000000098AAD5, ProductVersion.EP5)); // Pet Dog
                            gnomes.Add(new GnomeData(0x000000000098AAD4, ProductVersion.EP5)); // Pet Horse
                        }

                        if (GameUtils.IsInstalled(ProductVersion.EP6))
                        {
                            gnomes.Add(new GnomeData(0x000000000098D215, ProductVersion.EP6)); // Magician
                            gnomes.Add(new GnomeData(0x000000000098D214, ProductVersion.EP6)); // Singer
                        }
                    }

                    if (gnomes.Count > 0)
                    {
                        GnomeData preferred = RandomUtil.GetRandomObjectFromList(gnomes);

                        MagicGnomeBase gnome = ObjectCreation.CreateObject(preferred.mInstance, preferred.mVersion, null) as MagicGnomeBase;
                        if (gnome != null)
                        {
                            NameComponent name = gnome.GetComponent <NameComponent>();
                            if (name != null)
                            {
                                name.mName = mTarget.FullName;
                            }

                            gnome.SetPosition(location);
                            gnome.AddToWorld();
                        }
                    }
                }

                Genealogy genealogy = mTarget.CASGenealogy as Genealogy;

                if (genealogy != null)
                {
                    genealogy.ClearAllGenealogyInformation();
                }

                foreach (SimDescription other in SimDescription.GetSimDescriptionsInWorld())
                {
                    MiniSimDescription miniOther = MiniSimDescription.Find(other.SimDescriptionId);
                    if (miniOther == null)
                    {
                        continue;
                    }

                    miniOther.RemoveMiniRelatioship(mTarget.SimDescriptionId);
                }

                Annihilation.RemoveMSD(mTarget.SimDescriptionId);

                Relationship.RemoveSimDescriptionRelationships(mTarget);

                Urnstone urnstone = Urnstone.FindGhostsGrave(mTarget);

                if (urnstone != null)
                {
                    if ((urnstone.InInventory) && (urnstone.Parent != null) && (urnstone.Parent.Inventory != null))
                    {
                        urnstone.Parent.Inventory.RemoveByForce(urnstone);
                    }

                    urnstone.DestroyGrave();

                    try
                    {
                        urnstone.Dispose();
                    }
                    catch
                    { }
                }

                try
                {
                    mTarget.Dispose();

                    Assassination skill = Assassination.EnsureSkill(mActor);
                    if (skill != null)
                    {
                        skill.AddPotentialKill(mTarget, true);

                        bool witnessed = false;

                        if (lot != null)
                        {
                            witnessed = Assassination.WasWitnessed(lot, roomId, mActor.SimDescription, mTarget, new List <Sim>());
                        }

                        skill.AddActualKill(mTarget, false, witnessed);
                    }
                }
                catch
                { }
            }
コード例 #4
0
ファイル: Annihilation.cs プロジェクト: yakoder/NRaas
        public static bool Perform(SimDescription sim, bool cleanse)
        {
            if (sim == null)
            {
                return(false);
            }

            Common.StringBuilder msg = new Common.StringBuilder("Perform" + Common.NewLine);

            Household house = sim.Household;

            try
            {
                Sim createdSim = sim.CreatedSim;

                if (createdSim != null)
                {
                    createdSim.ReservedVehicle = null;
                }

                if (PetAdoption.sNeighborAdoption != null)
                {
                    if (PetAdoption.sNeighborAdoption.mMother == sim)
                    {
                        try
                        {
                            PetAdoption.ResetNeighborAdoption();
                        }
                        catch (Exception e)
                        {
                            Common.Exception(sim, e);
                        }
                        finally
                        {
                            PetAdoption.sNeighborAdoption = null;
                        }
                    }
                    else
                    {
                        PetAdoption.sNeighborAdoption.mPetsToAdopt.Remove(sim);
                    }
                }

                foreach (Service service in Services.AllServices)
                {
                    try
                    {
                        if (service == null)
                        {
                            continue;
                        }

                        msg += Common.NewLine + "Service: " + service.GetType();

                        if (sim.CreatedSim != null)
                        {
                            service.RemoveAssignment(sim.CreatedSim);
                        }

                        service.RemovePreferredSim(sim);

                        service.mPool.Remove(sim);

                        ResortWorker resortWorker = service as ResortWorker;
                        if (resortWorker != null)
                        {
                            if (resortWorker.mWorkerInfo != null)
                            {
                                List <ObjectGuid> remove = new List <ObjectGuid>();

                                foreach (KeyValuePair <ObjectGuid, ResortWorker.WorkerInfo> info in resortWorker.mWorkerInfo)
                                {
                                    if ((info.Value.CurrentSimDescriptionID == sim.SimDescriptionId) ||
                                        (info.Value.DesiredSimDescriptionID == sim.SimDescriptionId))
                                    {
                                        remove.Add(info.Key);
                                    }
                                }

                                foreach (ObjectGuid rem in remove)
                                {
                                    resortWorker.mWorkerInfo[rem] = new ResortWorker.WorkerInfo();
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Common.Exception(sim, null, msg, e);
                    }
                }

                msg += Common.NewLine + "A";

                List <Household> houses = new List <Household>();
                if (house != null)
                {
                    houses.Add(house);
                }

                foreach (Household check in Household.sHouseholdList)
                {
                    if (check == house)
                    {
                        continue;
                    }

                    if (check.Contains(sim))
                    {
                        houses.Add(check);
                    }
                }

                foreach (Household remove in houses)
                {
                    Household.HouseholdSimsChangedCallback changedCallback = null;

                    try
                    {
                        changedCallback             = remove.HouseholdSimsChanged;
                        remove.HouseholdSimsChanged = null;

                        remove.Remove(sim, !remove.IsSpecialHousehold);
                    }
                    finally
                    {
                        remove.HouseholdSimsChanged = changedCallback;
                    }
                }

                msg += Common.NewLine + "B";

                try
                {
                    if (cleanse)
                    {
                        if (sim.LifeEventManager != null)
                        {
                            sim.LifeEventManager.Purge();
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(sim, null, msg, e);
                }

                msg += Common.NewLine + "C";

                RemoveSimDescriptionRelationships(sim);

                msg += Common.NewLine + "D";

                PetPoolManager.RemoveIdFromPool(sim.SimDescriptionId);

                msg += Common.NewLine + "E";

                try
                {
                    if (sim.CareerManager != null)
                    {
                        sim.CareerManager.LeaveAllJobs(Career.LeaveJobReason.kDied);
                    }
                }
                catch (Exception e)
                {
                    sim.CareerManager.mJob    = null;
                    sim.CareerManager.mSchool = null;

                    Common.Exception(sim, null, msg, e);
                }

                msg += Common.NewLine + "F";

                if (sim.CASGenealogy == null)
                {
                    // Necessary to stop an error in MidLifeCrisisManager
                    sim.mGenealogy = new Genealogy(sim);
                }

                msg += Common.NewLine + "G";

                try
                {
                    if (sim.Partner != null)
                    {
                        sim.Partner.Partner = null;
                    }

                    sim.Partner = null;
                }
                catch (Exception e)
                {
                    Common.Exception(sim, null, msg, e);
                }

                msg += Common.NewLine + "H";

                if (sim.DeathStyle != SimDescription.DeathType.None)
                {
                    // Passing in a household can invoke the social worker, so don't bother
                    Urnstone.FinalizeSimDeath(sim, null /*house*/);
                }

                msg += Common.NewLine + "I";

                Urnstone urnstone = Urnstones.FindGhostsGrave(sim);

                msg += Common.NewLine + "J";

                if ((cleanse) && (urnstone != null))
                {
                    if (urnstone.InInventory)
                    {
                        Inventory inventory = Inventories.ParentInventory(urnstone);
                        if (inventory != null)
                        {
                            inventory.RemoveByForce(urnstone);
                        }
                    }

                    if (urnstone.DeadSimsDescription != null)
                    {
                        urnstone.DeadSimsDescription.Fixup();
                    }

                    try
                    {
                        urnstone.Dispose();
                    }
                    catch (Exception e)
                    {
                        Common.DebugException(sim, null, msg, e);
                    }

                    urnstone.Destroy();
                }

                msg += Common.NewLine + "K";

                if ((FakeMetaAutonomy.Instance != null) && (FakeMetaAutonomy.Instance.mPool != null))
                {
                    FakeMetaAutonomy.Instance.mPool.Remove(sim);
                }

                msg += Common.NewLine + "L";

                if (Sims3.Gameplay.Services.FakeMetaAutonomy.mToDestroy != null)
                {
                    Sims3.Gameplay.Services.FakeMetaAutonomy.mToDestroy.Remove(sim);
                }

                msg += Common.NewLine + "M";

                if ((houses.Contains(Household.ActiveHousehold)) && (sim.CreatedSim != null))
                {
                    HudModel model = HudController.Instance.Model as HudModel;

                    foreach (SimInfo info in model.mSimList)
                    {
                        if (info.mGuid == sim.CreatedSim.ObjectId)
                        {
                            model.RemoveSimInfo(info);
                            model.mSimList.Remove(info);
                            break;
                        }
                    }
                }

                msg += Common.NewLine + "N";

                try
                {
                    if (sim.AssignedRole != null)
                    {
                        sim.AssignedRole.RemoveSimFromRole();
                    }
                }
                catch (Exception e)
                {
                    Common.DebugException(sim, null, msg, e);

                    sim.AssignedRole = null;
                }

                msg += Common.NewLine + "O1";

                if ((CarNpcManager.Singleton != null) && (CarNpcManager.Singleton.NpcDriversManager != null))
                {
                    foreach (Stack <SimDescription> stack in CarNpcManager.Singleton.NpcDriversManager.mDescPools)
                    {
                        if (stack == null)
                        {
                            continue;
                        }

                        List <SimDescription> sims = new List <SimDescription>();

                        bool found = false;
                        foreach (SimDescription stackSim in stack)
                        {
                            if (stackSim == sim)
                            {
                                found = true;
                            }
                            else
                            {
                                sims.Add(stackSim);
                            }
                        }

                        if (found)
                        {
                            stack.Clear();

                            foreach (SimDescription stackSim in sims)
                            {
                                stack.Push(stackSim);
                            }
                        }
                    }
                }

                msg += Common.NewLine + "O2";

                if (cleanse)
                {
                    sim.Dispose();
                }

                msg += Common.NewLine + "P";

                if ((house != null) && (createdSim != null))
                {
                    house.OnMemberChanged(sim, createdSim);
                }
                return(true);
            }
            catch (Exception e)
            {
                Common.Exception(sim, null, msg, e);

                if (house != null)
                {
                    Household.HouseholdSimsChangedCallback changedCallback = null;

                    try
                    {
                        changedCallback            = house.HouseholdSimsChanged;
                        house.HouseholdSimsChanged = null;

                        house.Add(sim);
                    }
                    finally
                    {
                        house.HouseholdSimsChanged = changedCallback;
                    }
                }
                return(false);
            }
        }