Esempio n. 1
0
        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;
        }