Ejemplo n.º 1
0
        protected override OptionResult Run(GameHitParameters <GameObject> parameters)
        {
            if (!AcceptCancelDialog.Show(Common.Localize(GetTitlePrefix() + ":Prompt")))
            {
                return(OptionResult.Failure);
            }

            // Store for later use
            List <SimDescription> sims = new List <SimDescription>(GameStates.TravelHousehold.AllSimDescriptions);

            GameStates.sTravelData = null;

            WorldData.SetVacationWorld(false, true);

            WorldName currentWorld = GameUtils.GetCurrentWorld();

            foreach (SimDescription sim in sims)
            {
                MiniSimDescription miniSim = MiniSimDescription.Find(sim.SimDescriptionId);
                if (miniSim != null)
                {
                    miniSim.mHomeWorld = currentWorld;
                }

                sim.mHomeWorld = currentWorld;
            }

            if (Sim.ActiveActor != null)
            {
                (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).OnSimAgeChanged(Sim.ActiveActor.ObjectId);
            }

            return(OptionResult.SuccessClose);
        }
Ejemplo n.º 2
0
        protected static void RepairMiniSim(SimDescription sim)
        {
            if (sim == null)
            {
                return;
            }

            MiniSimDescription miniSim = MiniSimDescription.Find(sim.SimDescriptionId);

            if (miniSim != null)
            {
                if (sim.Partner != null)
                {
                    if (miniSim.PartnerSimDescriptionId != sim.Partner.SimDescriptionId)
                    {
                        Overwatch.Log(Relationships.GetFullName(sim) + " MiniSim Partner Reset");

                        miniSim.PartnerSimDescriptionId = sim.Partner.SimDescriptionId;
                    }
                }
                else
                {
                    if (miniSim.PartnerSimDescriptionId != 0)
                    {
                        Overwatch.Log(Relationships.GetFullName(sim) + " MiniSim Partner Cleared");

                        miniSim.PartnerSimDescriptionId = 0;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public static List <KnownInfo> GetKnownInfo(HudModel ths, IMiniSimDescription simDesc)
        {
            if ((ths.mSavedCurrentSim != null) && (ths.mSavedCurrentSim.SimDescription != null) && (simDesc != null))
            {
                if (ths.mSavedCurrentSim.SimDescription == simDesc)
                {
                    return(GetKnownInfoAboutSelf(ths, simDesc));
                }

                if (simDesc is SimDescription)
                {
                    if (ths.mSavedCurrentSim.SocialComponent != null)
                    {
                        foreach (Relationship relationship in ths.mSavedCurrentSim.SocialComponent.Relationships)
                        {
                            if (relationship == null)
                            {
                                continue;
                            }

                            SimDescription otherSimDescription = relationship.GetOtherSimDescription(ths.mSavedCurrentSim.SimDescription);
                            if (otherSimDescription != simDesc)
                            {
                                continue;
                            }

                            InformationLearnedAboutSim learnedInfo = relationship.InformationAbout(otherSimDescription);
                            return(GetKnownInfoList(ths, otherSimDescription, learnedInfo));
                        }
                    }
                }
                else
                {
                    MiniSimDescription tsd = MiniSimDescription.Find(ths.mSavedCurrentSim.SimDescription.SimDescriptionId);
                    if (tsd != null)
                    {
                        foreach (MiniRelationship relationship in tsd.MiniRelationships)
                        {
                            if (relationship == null)
                            {
                                continue;
                            }

                            if (relationship.SimDescriptionId != simDesc.SimDescriptionId)
                            {
                                continue;
                            }

                            MiniSimDescription otherTsd = MiniSimDescription.Find(relationship.SimDescriptionId);
                            return(relationship.GetKnownInfo(tsd, otherTsd));
                        }
                    }
                }
            }

            return(new List <KnownInfo>());
        }
Ejemplo n.º 4
0
        public new List <SimDescription> CreateNewbornsBeforePacking(float bonusMoodPoints, bool bAddToFamily, int householdSimMembers, int householdPetMembers)
        {
            MiniSimDescription miniDescription = null;
            SimDescription     description;

            if (mDad == null || mDad.HasBeenDestroyed)
            {
                description = SimDescription.Find(DadDescriptionId);

                if (description == null)
                {
                    miniDescription = MiniSimDescription.Find(DadDescriptionId);

                    if (miniDescription != null)
                    {
                        description = miniDescription.UnpackSim();
                        description.Genealogy.SetSimDescription(description);
                    }
                }
            }
            else
            {
                description = mDad.SimDescription;
            }

            float  averageMoodForBirth = GetAverageMoodForBirth(description, bonusMoodPoints);
            Random pregoRandom         = new Random(mRandomGenSeed);
            int    numForBirth         = GetNumForBirth(description, pregoRandom, householdSimMembers, householdPetMembers);
            Random gen = new Random(mRandomGenSeed);
            List <SimDescription> list = new List <SimDescription>();

            for (int i = 0; i < numForBirth; i++)
            {
                DetermineGenderOfBaby(gen);
                CASAgeGenderFlags gender = mGender;
                mGender = CASAgeGenderFlags.None;
                SimDescription description2 = AlienUtilsEx.MakeAlienBaby(description, mMom.SimDescription, gender, averageMoodForBirth, pregoRandom, false);
                description2.WasCasCreated = false;

                if (bAddToFamily)
                {
                    mMom.Household.Add(description2);
                    Sim sim = description2.Instantiate(mMom.Position);
                    CheckForGhostBaby(sim);
                }

                list.Add(description2);
            }

            if (miniDescription != null)
            {
                description.Dispose(true, true);
            }

            return(list);
        }
Ejemplo n.º 5
0
 public void Validate()
 {
     foreach (ulong sim in sims)
     {
         IMiniSimDescription desc = MiniSimDescription.Find(sim);
         if (desc == null)
         {
             sims.Remove(sim);
         }
     }
 }
Ejemplo n.º 6
0
 public static void EnsureForeignFather(Pregnancy pregnancy)
 {
     if (SimDescription.Find(pregnancy.DadDescriptionId) == null)
     {
         SimDescription dad = MiniSims.UnpackSim(MiniSimDescription.Find(pregnancy.DadDescriptionId));
         if (dad != null)
         {
             Household.CreateTouristHousehold();
             Household.TouristHousehold.AddTemporary(dad);
         }
     }
 }
Ejemplo n.º 7
0
        static bool CanGetPreggers(Sim sim)
        {
            if (SimTypes.IsPassporter(sim.SimDescription))
            {
                return(false);
            }

            int numHumans, numPets;

            sim.SimDescription.Household.GetNumberOfSimsAndPets(true, out numHumans, out numPets);

            if (!Household.CanSpeciesGetAddedToHousehold(sim.SimDescription.Species, numHumans, numPets))
            {
                return(false);
            }

            if (SimTypes.IsSkinJob(sim.SimDescription))
            {
                return(false);
            }
            else if (sim.BuffManager.HasTransformBuff())
            {
                return(false);
            }
            else if (sim.SimDescription.IsPregnant || sim.SimDescription.IsVisuallyPregnant)
            {
                return(false);
            }

            if (sim.Household != null && sim.Household.IsTouristHousehold)
            {
                MiniSimDescription description = MiniSimDescription.Find(sim.SimDescription.SimDescriptionId);

                if (description == null)
                {
                    return(false);
                }
            }
            else if (sim.LotHome == null)
            {
                return(false);
            }
            else if (sim.SimDescription.IsDueToAgeUp() || (sim.SimDescription.AgingState != null && sim.SimDescription.AgingState.IsAgingInProgress()))
            {
                return(false);
            }
            else if (SimTypes.IsLampGenie(sim.SimDescription))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 8
0
        public static SimDescription CreateProgenitor(ulong id, out bool unpacked)
        {
            unpacked = false;

            if (id == 0)
            {
                return(null);
            }

            if (FutureDescendantServiceEx.UnpackedSims.ContainsKey(id))
            {
                return(FutureDescendantServiceEx.UnpackedSims[id]);
            }

            SimDescription sim = SimDescription.Find(id);

            if (sim == null)
            {
                MiniSimDescription msd = MiniSimDescription.Find(id);
                if (msd == null)
                {
                    return(null);
                }

                // Custom
                sim = MiniSims.UnpackSimAndUpdateRel(msd);
                if (sim == null)
                {
                    return(null);
                }

                Household.CreateTouristHousehold();
                Household.TouristHousehold.AddTemporary(sim);
                msd.Instantiated = true;

                if (sim.AgingState != null)
                {
                    sim.AgingState.MergeTravelInformation(msd);
                }

                FutureDescendantServiceEx.UnpackedSims.Add(id, sim);

                SpeedTrap.Sleep();
                unpacked = true;
            }

            sim.Fixup();

            return(sim);
        }
Ejemplo n.º 9
0
        protected static void RemoveMiniRelationship(ulong a, ulong b)
        {
            MiniSimDescription description = MiniSimDescription.Find(a);

            if (description != null)
            {
                for (int i = 0; i < description.mMiniRelationships.Count; i++)
                {
                    if (description.mMiniRelationships[i].GetOtherSimDescriptionId(description) == b)
                    {
                        description.mMiniRelationships.RemoveAt(i);
                        return;
                    }
                }
            }
        }
Ejemplo n.º 10
0
            public static void ValidateAndSetupDoors()
            {
                List <ulong> removeSim = new List <ulong>();

                foreach (ObjectGuid guid in new List <ObjectGuid>(GoHere.Settings.mDoorSettings.Keys))
                {
                    DoorSettings settings = GoHere.Settings.mDoorSettings[guid];

                    if (Simulator.GetProxy(guid) != null && settings.SettingsValid)
                    {
                        foreach (KeyValuePair <ulong, long> sims in settings.mSimsRecentlyLetThrough)
                        {
                            if (!settings.WasSimRecentlyLetThrough(sims.Key))
                            {
                                removeSim.Add(sims.Key);
                            }
                            else if (MiniSimDescription.Find(sims.Key) == null)
                            {
                                removeSim.Add(sims.Key);
                            }
                        }

                        foreach (ulong sim in removeSim)
                        {
                            settings.mSimsRecentlyLetThrough.Remove(sim);
                        }

                        GoHere.Settings.AddOrUpdateDoorSettings(guid, settings, false);

                        Door door = GameObject.GetObject(guid) as Door;

                        if (door != null)
                        {
                            RegisterRoomListeners(door.LotCurrent);
                        }

                        continue;
                    }

                    GoHere.Settings.mDoorSettings.Remove(guid);
                }

                TooltipHelper.AddListener(typeof(Door), Type.GetType("NRaas.GoHereSpace.Helpers.DoorPortalComponentEx,NRaasGoHere").GetMethod("SceneWindow_Hover"));
            }
Ejemplo n.º 11
0
        protected static void SetGenealogy(IMiniSimDescription pureSim, Genealogy genealogy)
        {
            if (genealogy == null)
            {
                return;
            }

            SimDescription sim = pureSim as SimDescription;

            if (sim != null)
            {
                if ((sim.mGenealogy == null) ||
                    (!object.ReferenceEquals(sim.mGenealogy, genealogy)))
                {
                    sim.mGenealogy = genealogy;

                    Overwatch.Log("Replaced SimDesc Genealogy: " + Relationships.GetFullName(pureSim));
                }

                sim.mGenealogy.mSim     = sim;
                sim.mGenealogy.mMiniSim = MiniSimDescription.Find(sim.SimDescriptionId);
            }
            else
            {
                MiniSimDescription miniSim = pureSim as MiniSimDescription;
                if (miniSim != null)
                {
                    if ((miniSim.mGenealogy == null) ||
                        (!object.ReferenceEquals(miniSim.mGenealogy, genealogy)))
                    {
                        miniSim.mGenealogy = genealogy;

                        Overwatch.Log("Replaced MiniSim Genealogy: " + Relationships.GetFullName(pureSim));
                    }

                    if (genealogy.mSim == null)
                    {
                        genealogy.mSim = miniSim.mGenealogy.mSim;
                    }
                    genealogy.mMiniSim = miniSim;
                }
            }
        }
Ejemplo n.º 12
0
        public override void OnDelayedWorldLoadFinished()
        {
            Overwatch.Log("CleanupGigs");

            foreach (SimDescription sim in Household.EverySimDescription())
            {
                PerformanceCareer career = sim.OccupationAsPerformanceCareer;
                if (career == null)
                {
                    continue;
                }

                if (career.mSteadyGigs == null)
                {
                    career.mSteadyGigs = new List <SteadyGig>();

                    Overwatch.Log(" Missing GigList Added: " + sim.FullName);
                }

                for (int i = career.mSteadyGigs.Count - 1; i >= 0; i--)
                {
                    SteadyGig gig = career.mSteadyGigs[i];
                    if (gig == null)
                    {
                        career.mSteadyGigs.RemoveAt(i);

                        Overwatch.Log(" Null Gig removed: " + sim.FullName);
                    }
                    else if (gig.Venue == null)
                    {
                        career.mSteadyGigs.RemoveAt(i);

                        Overwatch.Log(" No Venue Gig removed: " + sim.FullName);
                    }
                    else if (MiniSimDescription.Find(gig.ProprietorId) == null)
                    {
                        career.mSteadyGigs.RemoveAt(i);

                        Overwatch.Log(" No Proprietor Gig removed: " + sim.FullName);
                    }
                }
            }
        }
Ejemplo n.º 13
0
            public static void ValidateAndSetupDoors()
            {
                List <ulong> removeSim = new List <ulong>();

                foreach (ObjectGuid guid in new List <ObjectGuid>(GoHere.Settings.mDoorSettings.Keys))
                {
                    DoorSettings settings = GoHere.Settings.mDoorSettings[guid];

                    if (Simulator.GetProxy(guid) != null && settings.SettingsValid)
                    {
                        foreach (KeyValuePair <ulong, long> sims in settings.mSimsRecentlyLetThrough)
                        {
                            if (!settings.WasSimRecentlyLetThrough(sims.Key))
                            {
                                removeSim.Add(sims.Key);
                            }
                            else if (MiniSimDescription.Find(sims.Key) == null)
                            {
                                removeSim.Add(sims.Key);
                            }
                        }

                        foreach (ulong sim in removeSim)
                        {
                            settings.mSimsRecentlyLetThrough.Remove(sim);
                        }

                        GoHere.Settings.AddOrUpdateDoorSettings(guid, settings, false);

                        Door door = GameObject.GetObject(guid) as Door;

                        if (door != null)
                        {
                            RegisterRoomListeners(door.LotCurrent);
                        }

                        continue;
                    }

                    GoHere.Settings.mDoorSettings.Remove(guid);
                }
            }
Ejemplo n.º 14
0
        public SimDescription GetSim(ulong id)
        {
            SimDescription sim;

            if ((mDescriptions != null) && (mDescriptions.TryGetValue(id, out sim)))
            {
                return(sim);
            }
            else
            {
                MiniSimDescription miniSim = MiniSimDescription.Find(id);
                if ((miniSim != null) && (miniSim.Genealogy != null))
                {
                    return(miniSim.Genealogy.mSim);
                }
                else
                {
                    return(null);
                }
            }
        }
Ejemplo n.º 15
0
        public static void ValidateFilters()
        {
            if (filters.Count > 0)
            {
                Dictionary <string, bool> liveFilters = GetFilters();
                foreach (string filter in new List <string>(filters.Keys))
                {
                    if (!liveFilters.ContainsKey(filter))
                    {
                        filters.Remove(filter);
                    }
                    else
                    {
                        List <ulong> mRemove = new List <ulong>();
                        foreach (KeyValuePair <ulong, SimFilter> kvp in filters[filter])
                        {
                            if (MiniSimDescription.Find(kvp.Key) == null)
                            {
                                mRemove.Add(kvp.Key);
                            }
                            else
                            {
                                kvp.Value.Validate();
                            }
                        }

                        foreach (ulong k in mRemove)
                        {
                            filters[filter].Remove(k);
                        }
                    }
                }
            }
            else
            {
                UpdateFilters();
            }
        }
Ejemplo n.º 16
0
        public static bool Cleanse(IMiniSimDescription me)
        {
            try
            {
                if (me == null)
                {
                    return(false);
                }

                SimDescription     sim  = me as SimDescription;
                MiniSimDescription mini = me as MiniSimDescription;

                CleanseGenealogy(me);

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

                    miniOther.RemoveMiniRelatioship(me.SimDescriptionId);
                }

                bool result = Perform(sim, true);

                RemoveMSD(me.SimDescriptionId);

                return(result);
            }
            catch (Exception e)
            {
                Common.Exception(me, e);
                return(false);
            }
        }
Ejemplo n.º 17
0
        public void OnWorldLoadFinished()
        {
            Overwatch.Log("CleanupCauseEffect");

            CauseEffectService instance = CauseEffectService.GetInstance();

            if (instance != null)
            {
                ulong timeTravelerSimID = instance.GetTimeTravelerSimID();
                if (MiniSimDescription.Find(timeTravelerSimID) == null)
                {
                    CauseEffectService.sPersistableData.TimeTravelerSimID = 0;

                    Overwatch.Log(" Removed Corrupt Time Traveler Referece");
                }

                List <ITimeStatueUiData> timeStatueData = instance.GetTimeAlmanacTimeStatueData();
                if (timeStatueData != null)
                {
                    foreach (ITimeStatueUiData data in timeStatueData)
                    {
                        TimeStatueRecordData record = data as TimeStatueRecordData;
                        if (record == null)
                        {
                            continue;
                        }

                        if (MiniSimDescription.Find(record.mRecordHolderId) == null)
                        {
                            record.mRecordHolderId = 0;

                            Overwatch.Log(" Removed Corrupt Record Holder Referece");
                        }
                    }
                }
            }
        }
Ejemplo n.º 18
0
        protected static void RepairMissingPartner(SimDescription trueSim)
        {
            if ((trueSim.Partner != null) && (trueSim.Partner.Partner != trueSim))
            {
                trueSim.Partner.mPartner = trueSim;

                Overwatch.Log("Missing Partner Relinked");
                Overwatch.Log("  " + Relationships.GetFullName(trueSim) + " - " + Relationships.GetFullName(trueSim.Partner));
            }

            MiniSimDescription miniSim = MiniSimDescription.Find(trueSim.SimDescriptionId);

            if (miniSim != null)
            {
                if (trueSim.Partner == null)
                {
                    miniSim.PartnerSimDescriptionId = 0;
                }
                else
                {
                    miniSim.PartnerSimDescriptionId = trueSim.Partner.SimDescriptionId;
                }
            }
        }
Ejemplo n.º 19
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;
        }
Ejemplo n.º 20
0
        public override List <Sim> CreateNewborns(float bonusMoodPoints, bool interactive, bool homeBirth)
        {
            SimDescription     alien     = null;
            MiniSimDescription miniAlien = null;

            if (mDad != null && !mDad.HasBeenDestroyed)
            {
                alien = mDad.SimDescription;
            }

            if (alien == null)
            {
                alien = SimDescription.Find(DadDescriptionId);

                if (alien == null)
                {
                    miniAlien = MiniSimDescription.Find(DadDescriptionId);

                    if (miniAlien != null)
                    {
                        alien = miniAlien.UnpackSim();

                        if (alien != null)
                        {
                            Household household = Household.Create(false);

                            if (household != null)
                            {
                                household.AddTemporary(alien);
                                alien.Genealogy.SetSimDescription(alien);
                            }
                        }
                    }
                }
            }

            float  averageMoodForBirth = GetAverageMoodForBirth(alien, bonusMoodPoints);
            Random pregoRandom         = new Random(mRandomGenSeed);
            int    numSimMembers       = 0;
            int    numPetMembers       = 0;

            mMom.Household.GetNumberOfSimsAndPets(true, out numSimMembers, out numPetMembers);
            int        numForBirth = GetNumForBirth(alien, pregoRandom, numSimMembers, numPetMembers);
            Random     gen         = new Random(mRandomGenSeed);
            List <Sim> list        = new List <Sim>();

            for (int i = 0; i < numForBirth; i++)
            {
                DetermineGenderOfBaby(gen);
                CASAgeGenderFlags gender = mGender;
                mGender = CASAgeGenderFlags.None;
                SimDescription babyDescription = AlienGenetics.MakeAlienBaby(alien, mMom.SimDescription, gender, averageMoodForBirth, pregoRandom, interactive);
                mMom.Household.Add(babyDescription);
                Sim baby = babyDescription.Instantiate(Vector3.Empty);
                baby.SetPosition(mMom.Position);

                if (homeBirth)
                {
                    TotallyHideBaby(baby);
                }

                list.Add(baby);
                CheckForGhostBaby(baby);

                if (baby.SimDescription.IsPlayableGhost)
                {
                    EventTracker.SendEvent(EventTypeId.kHadGhostBaby, mMom, baby);
                }

                if (i == 0)
                {
                    EventTracker.SendEvent(new SimDescriptionEvent(EventTypeId.kNewBaby, baby.SimDescription));
                }

                MidlifeCrisisManager.OnHadChild(mMom.SimDescription);
                EventTracker.SendEvent(EventTypeId.kNewOffspring, mMom, baby);
                //EventTracker.SendEvent(EventTypeId.kParentAdded, baby, mMom);

                if (mDad != null)
                {
                    EventTracker.SendEvent(EventTypeId.kNewOffspring, mDad, baby);
                    EventTracker.SendEvent(EventTypeId.kParentAdded, baby, mDad);
                }

                EventTracker.SendEvent(EventTypeId.kChildBornOrAdopted, null, baby);
            }

            if (miniAlien != null)
            {
                alien.Household.Destroy();
                alien.Household.RemoveTemporary(alien);
                alien.Dispose(true, true);
            }

            if (mMom.Household != null)
            {
                mMom.Household.InvalidateThumbnail();
            }

            switch (numForBirth)
            {
            case 1:
                EventTracker.SendEvent(new SimDescriptionEvent(EventTypeId.kNewBabySingle, mMom.SimDescription));
                break;

            case 2:
                EventTracker.SendEvent(new SimDescriptionEvent(EventTypeId.kNewBabyTwins, mMom.SimDescription));
                break;

            case 3:
                EventTracker.SendEvent(new SimDescriptionEvent(EventTypeId.kNewBabyTriplets, mMom.SimDescription));
                break;

            case 4:
                break;
            }

            return(list);
        }
Ejemplo n.º 21
0
        public static string GetStatus(SimDescription sim)
        {
            string str = sim.FullName;

            bool serviceOrRole = false;

            if (sim.AssignedRole != null)
            {
                serviceOrRole = true;
                ShoppingRegister register = sim.AssignedRole.RoleGivingObject as ShoppingRegister;
                if (register != null)
                {
                    str += ", " + register.RegisterRoleName(sim.IsFemale);
                }
                else
                {
                    string roleName;
                    if (Localization.GetLocalizedString(sim.AssignedRole.CareerTitleKey, out roleName))
                    {
                        str += ", " + roleName;
                    }
                }

                string hours = GetRoleHours(sim);
                if (!string.IsNullOrEmpty(hours))
                {
                    str += Common.NewLine + hours;
                }
            }
            else if (SimTypes.InServicePool(sim))
            {
                serviceOrRole = true;

                string serviceName;
                if (Localization.GetLocalizedString("Ui/Caption/Services/Service:" + sim.CreatedByService.ServiceType.ToString(), out serviceName))
                {
                    str += ", " + serviceName;
                }
            }

            if ((serviceOrRole) || (Tagger.Settings.mTagDataSettings[TagDataType.Orientation] && Tagger.Settings.mTagDataSettings[TagDataType.LifeStage] && (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || (Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage] && sim.AgingEnabled))))
            {
                str += Common.NewLine;
            }
            else
            {
                str += " - ";
            }

            if (sim.TeenOrAbove && !sim.IsPet && Tagger.Settings.mTagDataSettings[TagDataType.Orientation])
            {
                str += Common.Localize("SimType:" + TagDataHelper.GetOrientation(sim).ToString());
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.LifeStage])
            {
                if (Tagger.Settings.mTagDataSettings[TagDataType.Orientation])
                {
                    str += " ";
                }

                str += sim.AgeLocalizedText;
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage])
            {
                str += " (";
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays])
            {
                str += Common.Localize("TagData:Age", sim.IsFemale, new object[] { Math.Round(Aging.GetCurrentAgeInDays(sim as IMiniSimDescription)) });
            }

            if (sim.AgingEnabled)
            {
                if (Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage])
                {
                    str += ", " + Common.Localize("TagData:Birthday", sim.IsFemale, new object[] { (int)(AgingManager.Singleton.AgingYearsToSimDays(AgingManager.GetMaximumAgingStageLength(sim)) - AgingManager.Singleton.AgingYearsToSimDays(sim.AgingYearsSinceLastAgeTransition)) });
                }
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage])
            {
                str += ")";
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.Occult] && sim.OccultManager != null)
            {
                List <OccultTypes> types = OccultTypeHelper.CreateList(sim, false);

                if (types.Count > 0)
                {
                    str += Common.NewLine;

                    string occultString = "";
                    foreach (OccultTypes type in types)
                    {
                        occultString += ", " + OccultTypeHelper.GetLocalizedName(type);
                    }

                    str += Common.Localize("TagData:OccultTag", sim.IsFemale, new object[] { occultString.Remove(0, 2) });
                }
            }

            Sim createdSim = sim.CreatedSim;

            if (Tagger.Settings.Debugging)
            {
                if (createdSim != null)
                {
                    str += Common.NewLine + "Autonomy: ";
                    if (createdSim.Autonomy == null)
                    {
                        str += "None";
                    }
                    else
                    {
                        if (createdSim.Autonomy.AutonomyDisabled)
                        {
                            str += "Disabled";
                        }
                        else if (!AutonomyRestrictions.IsAnyAutonomyEnabled(createdSim))
                        {
                            str += "User Disabled";
                        }
                        else if (createdSim.Autonomy.IsRunningHighLODSimulation)
                        {
                            str += "High";
                        }
                        else
                        {
                            str += "Low";
                        }

                        if (createdSim.Autonomy.ShouldRunLocalAutonomy)
                        {
                            str += " Local";
                        }

                        if (createdSim.CanRunAutonomyImmediately())
                        {
                            str += " Ready";
                        }
                        else if (!createdSim.mLastInteractionWasAutonomous)
                        {
                            str += " Push";
                        }
                        else if (!createdSim.mLastInteractionSucceeded)
                        {
                            str += " Fail";
                        }

                        if (createdSim.Autonomy.InAutonomyManagerQueue)
                        {
                            str += " Queued";
                        }
                    }
                }
            }

            if (createdSim != null)
            {
                if (Tagger.Settings.mTagDataSettings[TagDataType.Mood])
                {
                    str += Common.NewLine;
                    int flavour = (int)createdSim.MoodManager.MoodFlavor;

                    str += Common.Localize("TagData:MoodTag", sim.IsFemale, new object[] { Common.LocalizeEAString(false, "Ui/Tooltip/HUD/SimDisplay:MoodFlavor" + flavour.ToString()) }) + " ";
                }

                if (Tagger.Settings.mTagDataSettings[TagDataType.MotiveInfo])
                {
                    if (!Tagger.Settings.mTagDataSettings[TagDataType.Mood])
                    {
                        str += Common.NewLine;
                    }

                    string motives = ", ";
                    int    num     = 0;
                    foreach (CommodityKind kind in (Sims3.UI.Responder.Instance.HudModel as HudModel).GetMotives(sim.CreatedSim))
                    {
                        if (sim.CreatedSim.Motives.HasMotive(kind))
                        {
                            if (num >= 6)
                            {
                                break;
                            }

                            motives += FetchMotiveLocalization(sim.Species, kind) + ": " + "(" + sim.CreatedSim.Motives.GetValue(kind).ToString("0.") + ") ";
                        }

                        num++;
                    }

                    str += Common.Localize("TagData:Motives", sim.IsFemale, new object[] { motives.Remove(0, 2) });
                }

                if (Tagger.Settings.mTagDataSettings[TagDataType.CurrentInteraction] && createdSim.CurrentInteraction != null)
                {
                    str += Common.NewLine;

                    try
                    {
                        str += createdSim.CurrentInteraction.ToString();
                    }
                    catch (Exception e)
                    {
                        Common.DebugException(createdSim, e);

                        str += createdSim.CurrentInteraction.GetType();
                    }

                    Tone tone = createdSim.CurrentInteraction.CurrentTone;
                    if (tone != null)
                    {
                        str += Common.NewLine + tone.ToString();
                    }

                    SocialInteractionBase social = createdSim.CurrentInteraction as SocialInteractionBase;
                    if ((social != null) && (social.Target != null))
                    {
                        str += " " + Common.Localize("TagData:With", sim.IsFemale, new object[] { social.Target.Name });
                    }

                    if (createdSim.CurrentInteraction is Terrain.GoHereWith)
                    {
                        InviteToLotSituation situtation = InviteToLotSituation.FindInviteToLotSituationInvolving(createdSim);
                        if (situtation != null)
                        {
                            if (situtation.SimA != createdSim)
                            {
                                str += " " + situtation.SimA.Name;
                            }
                            else if (situtation.SimB != createdSim)
                            {
                                str += situtation.SimB.Name;
                            }
                        }
                    }
                }
            }

            if (!SimTypes.IsSpecial(sim))
            {
                str += Common.NewLine + Common.Localize("TagData:CashTag", sim.IsFemale, new object[] { sim.FamilyFunds });

                if ((Tagger.Settings.mTagDataSettings[TagDataType.Debt] || Tagger.Settings.mTagDataSettings[TagDataType.NetWorth]) && sGetDebtAndNetworth.Valid)
                {
                    int bit = 0;
                    if (Tagger.Settings.mTagDataSettings[TagDataType.Debt])
                    {
                        bit = bit + 1;
                    }
                    if (Tagger.Settings.mTagDataSettings[TagDataType.NetWorth])
                    {
                        bit = bit + 4;
                    }

                    str += sGetDebtAndNetworth.Invoke <string>(new object[] { sim, bit });
                }

                if (Tagger.Settings.mTagDataSettings[TagDataType.Job])
                {
                    if (sim.Occupation != null)
                    {
                        str += Common.NewLine;
                        if (sim.Occupation.OfficeLocation != null)
                        {
                            str += Common.Localize("TagData:JobAt", sim.IsFemale, new object[] { sim.Occupation.CurLevelJobTitle, sim.Occupation.OfficeLocation.GetLocalizedName() });
                        }
                        else
                        {
                            str += Common.Localize("TagData:JobTag", sim.IsFemale, new object[] { sim.Occupation.CurLevelJobTitle });
                        }
                    }
                }

                if (Tagger.Settings.mTagDataSettings[TagDataType.PartnerInfo])
                {
                    if (sim.Partner != null)
                    {
                        Relationship rel    = sim.GetRelationship(sim.Partner, false);
                        string       status = "Happily";
                        if (rel != null)
                        {
                            if (rel.CurrentLTRLiking < -15)
                            {
                                status = "Unhappily";
                            }
                        }

                        str += Common.NewLine;

                        if (sim.IsMarried)
                        {
                            str += Common.Localize("TagData:Spouse", sim.IsFemale, new object[] { Common.Localize("TagData:" + status), sim.Partner });
                        }
                        else
                        {
                            str += Common.Localize("TagData:Partner", sim.IsFemale, new object[] { sim.Partner });
                        }
                    }
                }
            }

            if (sim.IsPregnant && Tagger.Settings.mTagDataSettings[TagDataType.PregnancyInfo])
            {
                IMiniSimDescription father = SimDescription.Find(sim.Pregnancy.DadDescriptionId);
                if (father == null)
                {
                    father = MiniSimDescription.Find(sim.Pregnancy.DadDescriptionId);
                }

                str += Common.NewLine;

                if (father != null)
                {
                    if (sim.Partner != null && father != sim.Partner && !sim.IsPet)
                    {
                        string uhoh = Common.Localize("TagData:Uhoh");
                        str += Common.Localize("TagData:Pregnancy", sim.IsFemale, new object[] { father, uhoh });
                    }
                    else
                    {
                        str += Common.Localize("TagData:Pregnancy", sim.IsFemale, new object[] { father });
                    }
                }
                else
                {
                    str += Common.Localize("TagData:PregnancyUnknown", sim.IsFemale);
                }
            }

            if (Tagger.Settings.mTagDataSettings[TagDataType.PersonalityInfo] && sGetClanInfo.Valid)
            {
                List <string> info = sGetClanInfo.Invoke <List <string> >(new object [] { sim });
                foreach (string personality in info)
                {
                    str += Common.NewLine + personality;
                }
            }

            return(str);
        }
Ejemplo n.º 22
0
            public bool IsSimAllowedThrough(ulong descId)
            {
                IMiniSimDescription desc = SimDescription.Find(descId);

                if (desc == null)
                {
                    desc = MiniSimDescription.Find(descId) as MiniSimDescription;
                }

                Door door = GameObject.GetObject(mGUID) as Door;

                if (door != null && door.LotCurrent != null && desc != null)
                {
                    SimDescription desc2 = desc as SimDescription;
                    if (desc2 != null && desc2.CreatedSim != null)
                    {
                        if (desc2.Service != null)
                        {
                            List <Sim> sims = desc2.Service.GetSimsAssignedToLot(door.LotCurrent);
                            if (sims.Contains(desc2.CreatedSim) && GoHere.Settings.mServiceSimsIgnoreAllDoorOptions)
                            {
                                return(true);
                            }
                        }

                        if (desc2.HasActiveRole)
                        {
                            if (desc2.AssignedRole != null && desc2.AssignedRole.RoleGivingObject != null)
                            {
                                if (desc2.AssignedRole.RoleGivingObject.InWorld && desc2.AssignedRole.RoleGivingObject.LotCurrent != null)
                                {
                                    if (desc2.AssignedRole.RoleGivingObject.LotCurrent == door.LotCurrent && GoHere.Settings.mRoleSimsIgnoreAllDoorOptions)
                                    {
                                        return(true);
                                    }
                                }
                            }
                        }
                    }

                    if (GoHere.Settings.mGlobalIgnoreAllDoorOptionsFilterOption.Count > 0)
                    {
                        if (FilterHelper.DoesSimMatchFilters(descId, GoHere.Settings.mGlobalIgnoreAllDoorOptionsFilterOption, false))
                        {
                            return(true);
                        }
                    }

                    if (mDoorOpen != -1 && mDoorClose != -1)
                    {
                        bool allowed = true;
                        if (!SimClock.IsTimeBetweenTimes(mDoorOpen, mDoorClose))
                        {
                            allowed = false;

                            if (GoHere.Settings.mGlobalIgnoreDoorTimeLocksFilterOption.Count > 0)
                            {
                                allowed = FilterHelper.DoesSimMatchFilters(descId, GoHere.Settings.mGlobalIgnoreDoorTimeLocksFilterOption, false);
                            }

                            /*
                             * if (PlumbBob.SelectedActor != null && desc.HasSameHomeLot(PlumbBob.SelectedActor.SimDescription))
                             * {
                             *  allowed = true;
                             * }
                             *
                             * if (desc2 != null && desc2.CreatedSim != null)
                             * {
                             *  if (desc2.CareerManager != null)
                             *  {
                             *      if (desc2.CareerManager.OccupationAsActiveCareer != null)
                             *      {
                             *          if (desc2.CareerManager.OccupationAsActiveCareer.HasJobAtLot(door.LotCurrent))
                             *          {
                             *              allowed = true;
                             *          }
                             *      }
                             *
                             *      if (desc2.CreatedSim.CareerLocation != null)
                             *      {
                             *          if (desc2.CreatedSim.CareerLocation.LotCurrent == door.LotCurrent)
                             *          {
                             *              allowed = true;
                             *          }
                             *      }
                             *  }
                             * }
                             */
                        }

                        if (!allowed)
                        {
                            return(allowed);
                        }
                    }

                    if (FiltersEnabled > 0)
                    {
                        if (GoHere.Settings.mGlobalIgnoreDoorFiltersFilterOption.Count > 0)
                        {
                            if (FilterHelper.DoesSimMatchFilters(descId, GoHere.Settings.mGlobalIgnoreDoorFiltersFilterOption, false))
                            {
                                return(true);
                            }
                        }

                        if (mMatchAllFilters)
                        {
                            if (mType == SettingType.Allow)
                            {
                                return(FilterHelper.DoesSimMatchFilters(descId, mActiveFilters, true));
                            }
                            else
                            {
                                return(!FilterHelper.DoesSimMatchFilters(descId, mActiveFilters, true));
                            }
                        }
                        else
                        {
                            if (mType == SettingType.Allow)
                            {
                                return(FilterHelper.DoesSimMatchFilters(descId, mActiveFilters, false));
                            }
                            else
                            {
                                return(!FilterHelper.DoesSimMatchFilters(descId, mActiveFilters, false));
                            }
                        }
                    }
                }

                return(FiltersEnabled == 0);
            }
Ejemplo n.º 23
0
        /*
         * 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);
            }
        }
Ejemplo n.º 24
0
        public static void _NPostLoadFixUp()
        {
            if (runI)
            {
                return;
            }

            var list = new List <SimDescription>();

            foreach (Household sHousehold in Household.sHouseholdList)
            {
                bool isPreviousTravelerHousehold         = !sHousehold.IsPreviousTravelerHousehold;
                List <SimDescription> allSimDescriptions = sHousehold.AllSimDescriptions;
                int i = 0;

                while (i < allSimDescriptions.Count)
                {
                    var simd = allSimDescriptions[i];
                    try
                    {
                        sLoadedSimDescriptions.Remove(simd);

                        simd.Fixup();

                        MiniSimDescription miniSimDescription = MiniSimDescription.Find(simd.SimDescriptionId);
                        if (miniSimDescription != null && isPreviousTravelerHousehold)
                        {
                            miniSimDescription.Instantiated = true;
                        }

                        if (simd.IsEnrolledInBoardingSchool())
                        {
                            list.Add(simd);
                        }
                    }
                    catch (Exception)
                    {
                        //simd.Dispose();
                        i++;
                        continue;
                    }
                    i++;
                }
                sHousehold.PostSimDescriptionLoadFixup();
            }

            if (list.Count > 0 && !GameUtils.IsInstalled(ProductVersion.EP4))
            {
                foreach (var item in list)
                {
                    if (item.BoardingSchool != null)
                    {
                        item.BoardingSchool.OnRemovedFromSchool();
                    }

                    item.AssignSchool();

                    if (item.CreatedSim == null)
                    {
                        item.Instantiate(item.LotHome);
                    }
                }
            }

            var dictionary = new Dictionary <SimDescription, bool>();

            foreach (KeyValuePair <SimDescription, Dictionary <SimDescription, Relationship> > sAllRelationship in Relationship.sAllRelationships)
            {
                SimDescription key = sAllRelationship.Key;
                if (!key.IsValidDescription)
                {
                    dictionary[key] = true;
                }

                foreach (SimDescription item in new List <SimDescription>(sAllRelationship.Value.Keys))
                {
                    if (!item.IsValidDescription)
                    {
                        dictionary[item] = true;
                    }
                }
            }

            foreach (SimDescription key in dictionary.Keys)
            {
                Relationship.RemoveSimDescriptionRelationships(key);
            }

            sLoadedSimDescriptions.Clear();
        }
Ejemplo n.º 25
0
        public Sim _NInstantiate(Vector3 position, ResourceKey outfitKey, bool addInitialObjects, bool forceAlwaysAnimate)
        {
            if (runI)
            {
                return(null);
            }

            if (NiecHelperSituation.__acorewIsnstalled__)
            {
                if (!Instantiator.kDontCallDGSACore && NFinalizeDeath.RUNIACORE != null)
                {
                    NFinalizeDeath.RUNIACORE(false);
                }
                else
                {
                    NFinalizeDeath.CheckNHSP();
                }
            }

            if (CreatedSim != null)
            {
                return(CreatedSim);
            }

            if (AgingState != null)
            {
                bool isDefaultOutfit = outfitKey == mDefaultOutfitKey;
                AgingState.PreInstantiateSim(ref outfitKey);
                if (isDefaultOutfit)
                {
                    mDefaultOutfitKey = outfitKey;
                }
            }

            Hashtable hashtable = new Hashtable(forceAlwaysAnimate ? 4 : 2);

            hashtable["simOutfitKey"] = outfitKey;
            hashtable["rigKey"]       = CASUtils.GetRigKeyForAgeGenderSpecies(Age | Gender | Species);

            if (forceAlwaysAnimate)
            {
                hashtable["enableSimPoseProcessing"] = 1u;
                hashtable["animationRunsInRealtime"] = 1u;
            }

            string         instanceName = "GameSim";
            ProductVersion version      = ProductVersion.BaseGame;

            if (Species != CASAgeGenderFlags.Human)
            {
                instanceName = "Game" + Species;
                version      = ProductVersion.EP5;
            }

            bool shouldNullHousehold = false;

            if (Household == null)
            {
                mHousehold          = Household.NpcHousehold ?? Household.ActiveHousehold;
                shouldNullHousehold = true;
            }

            Sim sim = GlobalFunctions.CreateObjectWithOverrides(instanceName, version, position, 0, Vector3.UnitZ, hashtable, new SimInitParameters(this)) as Sim;

            if (sim != null)
            {
                sim.mSimDescription = this;
                this.mSim           = sim;

                if (sim.SimRoutingComponent != null)
                {
                    sim.SimRoutingComponent.EnableDynamicFootprint();
                    sim.SimRoutingComponent.ForceUpdateDynamicFootprint();
                }

                try
                {
                    if (sim.IsSelectable)
                    {
                        sim.AddInitialObjects(true);
                    }
                }
                catch (ResetException)
                { throw; }
                catch (Exception)
                { }

                PushAgingEnabledToAgingManager();

                if (OccultManager != null)
                {
                    OccultManager.SetupForInstantiatedSim();
                }

                if (GameUtils.IsFutureWorld())
                {
                    CauseEffectService.ApplyCauseAndEffectModsToSim(sim);
                }
                if (IsAlien)
                {
                    World.ObjectSetVisualOverride(sim.ObjectId, eVisualOverrideTypes.Alien, null);
                }

                if (EventTracker.sInstance != null)
                {
                    EventTracker.SendEvent(EventTypeId.kSimInstantiated, null, sim);
                }

                MiniSimDescription miniSimDescription = MiniSimDescription.Find(SimDescriptionId);
                if (miniSimDescription != null && (GameStates.IsTravelling || mHomeWorld != GameUtils.GetCurrentWorld()))
                {
                    miniSimDescription.UpdateInWorldRelationships(this);
                }

                if (HealthManager != null)
                {
                    HealthManager.Startup();
                }

                if (Household.RoommateManager != null && Household.RoommateManager.IsNPCRoommate(SimDescriptionId))
                {
                    Household.RoommateManager.AddRoommateInteractions(sim);
                }
            }

            if (OccultManager != null && SkinToneKey.InstanceId == 15475186560318337848uL && !OccultManager.HasOccultType(OccultTypes.Vampire) && !OccultManager.HasOccultType(OccultTypes.Werewolf) && !IsGhost)
            {
                World.ObjectSetVisualOverride(CreatedSim.ObjectId, eVisualOverrideTypes.Genie, null);
            }

            if (Household != null && Household.IsAlienHousehold)
            {
                (Sims3.UI.Responder.Instance.HudModel as HudModel).OnSimCurrentWorldChanged(true, this);
            }

            if (shouldNullHousehold && mHousehold == Household.NpcHousehold)
            {
                mHousehold = null;
            }

            sim.mSimDescription = this;
            this.mSim           = sim;

            return(sim);
        }
Ejemplo n.º 26
0
            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
                { }
            }
Ejemplo n.º 27
0
        public static Sim Perform(Sim sim, bool fadeOut)
        {
            if (sim == null)
            {
                return(null);
            }

            try
            {
                SimDescription simDesc = sim.SimDescription;

                if (Simulator.GetProxy(sim.ObjectId) == null)
                {
                    if (simDesc != null)
                    {
                        sim.Destroy();
                    }

                    //sim.mSimDescription = null;
                    return(null);
                }

                if (simDesc == null)
                {
                    sim.mSimDescription = new SimDescription();

                    sim.Destroy();
                    return(null);
                }

                if (sim.LotHome != null)
                {
                    simDesc.IsZombie = false;

                    if (simDesc.CreatedSim != sim)
                    {
                        sim.Destroy();

                        simDesc.CreatedSim = null;

                        return(null);
                    }
                    else
                    {
                        Bed     myBed     = null;
                        BedData myBedData = null;

                        foreach (Bed bed in sim.LotHome.GetObjects <Bed>())
                        {
                            myBedData = bed.GetPartOwnedBy(sim);
                            if (myBedData != null)
                            {
                                myBed = bed;
                                break;
                            }
                        }

                        ResetPosture(sim);

                        if (simDesc.TraitManager == null)
                        {
                            simDesc.mTraitManager = new TraitManager();
                        }

                        try
                        {
                            simDesc.Fixup();

                            Corrections.CleanupBrokenSkills(simDesc, null);

                            ResetCareer(simDesc);

                            simDesc.ClearSpecialFlags();

                            if (simDesc.Pregnancy == null)
                            {
                                try
                                {
                                    if (simDesc.mMaternityOutfits == null)
                                    {
                                        simDesc.mMaternityOutfits = new OutfitCategoryMap();
                                    }
                                    simDesc.SetPregnancy(0, false);

                                    simDesc.ClearMaternityOutfits();
                                }
                                catch (Exception e)
                                {
                                    Common.Exception(sim, null, "Pregnancy", e);
                                }
                            }

                            if (sim.CurrentCommodityInteractionMap == null)
                            {
                                try
                                {
                                    LotManager.PlaceObjectOnLot(sim, sim.ObjectId);

                                    if (sim.CurrentCommodityInteractionMap == null)
                                    {
                                        sim.ChangeCommodityInteractionMap(sim.LotHome.Map);
                                    }
                                }
                                catch (Exception e)
                                {
                                    Common.Exception(sim, null, "ChangeCommodityInteractionMap", e);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Common.Exception(sim, null, "Fixup", e);
                        }

                        ResetSituations(sim);

                        CleanupSlots(sim);

                        ResetInventory(sim);

                        if (fadeOut)
                        {
                            bool active = (Sim.ActiveActor == sim);

                            if (sSimReset.Valid)
                            {
                                sSimReset.Invoke <bool>(new object[] { simDesc.SimDescriptionId });
                            }

                            ResetRouting(sim);

                            using (CreationProtection protection = new CreationProtection(simDesc, sim, false, true, false))
                            {
                                sim.Destroy();

                                Common.Sleep();

                                sim = FixInvisibleTask.InstantiateAtHome(simDesc, null);
                            }

                            if (sim != null)
                            {
                                if (active)
                                {
                                    try
                                    {
                                        foreach (Sim member in Households.AllSims(sim.Household))
                                        {
                                            if (member.CareerManager == null)
                                            {
                                                continue;
                                            }

                                            Occupation occupation = member.CareerManager.Occupation;
                                            if (occupation == null)
                                            {
                                                continue;
                                            }

                                            occupation.FormerBoss = null;
                                        }

                                        using (DreamCatcher.HouseholdStore store = new DreamCatcher.HouseholdStore(sim.Household, true))
                                        {
                                            PlumbBob.DoSelectActor(sim, true);
                                        }
                                    }
                                    catch (Exception e)
                                    {
                                        Common.Exception(sim, null, "DoSelectActor", e);
                                    }
                                }

                                if ((myBed != null) && (myBedData != null))
                                {
                                    if (!(myBed is BedMultiPart) || (myBed is BedMultiPart && ((sim.Partner != null) && (sim.Partner.CreatedSim != null))))
                                    {
                                        myBed.ClaimOwnership(sim, myBedData);
                                    }
                                    else
                                    {
                                        HandleDoubleBed(sim, myBed, myBedData);
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (sim.Inventory == null)
                            {
                                sim.AddComponent <InventoryComponent>(new object[0x0]);
                            }

                            if (Instantiation.AttemptToPutInSafeLocation(sim, false))
                            {
                                ResetRouting(sim);

                                sim.SetObjectToReset();

                                // This is necessary to clear certain types of interactions
                                //   (it is also called in SetObjectToReset(), though doesn't always work there)
                                if (sim.InteractionQueue != null)
                                {
                                    sim.InteractionQueue.OnReset();
                                }
                            }
                        }

                        ResetSkillModifiers(simDesc);

                        ResetRole(sim);

                        if (simDesc.IsEnrolledInBoardingSchool())
                        {
                            simDesc.BoardingSchool.OnRemovedFromSchool();
                        }

                        MiniSimDescription miniSim = MiniSimDescription.Find(simDesc.SimDescriptionId);
                        if (miniSim != null)
                        {
                            miniSim.Instantiated = true;
                        }

                        UpdateInterface(sim);

                        return(sim);
                    }
                }
                else if (simDesc.Service is Butler)
                {
                    if (Instantiation.AttemptToPutInSafeLocation(sim, true))
                    {
                        sim.Motives.RecreateMotives(sim);
                        sim.SetObjectToReset();
                    }

                    return(sim);
                }
                else if (simDesc.IsImaginaryFriend)
                {
                    OccultImaginaryFriend friend;
                    if (OccultImaginaryFriend.TryGetOccultFromSim(sim, out friend))
                    {
                        if (Simulator.GetProxy(friend.mDollId) != null)
                        {
                            friend.TurnBackIntoDoll(OccultImaginaryFriend.Destination.Owner);

                            return(null);
                        }
                    }
                }
                else if (simDesc.IsBonehilda)
                {
                    foreach (BonehildaCoffin coffin in Sims3.Gameplay.Queries.GetObjects <BonehildaCoffin>())
                    {
                        if (coffin.mBonehilda == simDesc)
                        {
                            coffin.mBonehildaSim = null;
                            break;
                        }
                    }
                }

                if (fadeOut)
                {
                    sim.Destroy();
                }

                return(null);
            }
            catch (Exception exception)
            {
                Common.Exception(sim, exception);
                return(sim);
            }
        }
Ejemplo n.º 28
0
        private static bool CanGetPreggers(Sim sim, bool isAutonomous, ref GreyedOutTooltipCallback callback, out string reason)
        {
            using (Common.TestSpan span = new Common.TestSpan(ScoringLookup.Stats, "Duration CanGetPreggers", Common.DebugLevel.Stats))
            {
                if (SimTypes.IsPassporter(sim.SimDescription))
                {
                    reason   = "Passport";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }

                if (isAutonomous)
                {
                    if (!sim.IsRobot && sim.SimDescription.Elder)
                    {
                        reason   = "Elder";
                        callback = Common.DebugTooltip(reason);
                        return(false);
                    }
                    else if (Households.IsFull(sim.Household, sim.IsPet, Woohooer.Settings.mMaximumHouseholdSizeForAutonomousV2[PersistedSettings.GetSpeciesIndex(sim)]))
                    {
                        reason   = "House Full";
                        callback = Common.DebugTooltip(reason);
                        return(false);
                    }
                }
                else
                {
                    if (!CommonPregnancy.SatisfiesMaximumOccupants(sim, isAutonomous, ref callback))
                    {
                        reason = "Maximum Occupants";
                        return(false);
                    }
                }

                if (!sim.IsRobot && SimTypes.IsSkinJob(sim.SimDescription))
                {
                    reason   = "Non-Robot Skin Job Fail";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }
                else if (sim.BuffManager.HasTransformBuff())
                {
                    reason   = "Transform Buff";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }
                else if (!sim.IsRobot && sim.SimDescription.IsVisuallyPregnant)
                {
                    reason   = "Already Pregnant";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }
                else if (sim.IsRobot && sim.SimDescription.IsPregnant)
                {
                    reason   = "Already Pregnant";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }

                if (sim.Household != null && sim.Household.IsTouristHousehold)
                {
                    MiniSimDescription description = MiniSimDescription.Find(sim.SimDescription.SimDescriptionId);

                    if (description == null)
                    {
                        reason   = "Too Many Sims";
                        callback = delegate
                        {
                            return(Common.LocalizeEAString(sim.IsFemale, "Gameplay/Actors/Sim/TryForBaby:TooManySims", new object[] { sim }));
                        };
                        return(false);
                    }
                }
                else if (sim.LotHome == null)
                {
                    reason   = "Too Many Sims";
                    callback = delegate
                    {
                        if (sim.Household.IsAlienHousehold)
                        {
                            return(Common.LocalizeEAString(sim.IsFemale, "Gameplay/Actors/Sim/TryForBaby:AlienNPCs", new object[] { sim }));
                        }
                        else
                        {
                            return(Common.LocalizeEAString(sim.IsFemale, "Gameplay/Actors/Sim/TryForBaby:TooManySims", new object[] { sim }));
                        }
                    };
                    return(false);
                }
                else if (sim.SimDescription.IsDueToAgeUp() || (sim.SimDescription.AgingState != null && sim.SimDescription.AgingState.IsAgingInProgress()))
                {
                    reason   = "Aging Up Fail";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }
                else if (SimTypes.IsLampGenie(sim.SimDescription))
                {
                    reason   = "Lamp Genie";
                    callback = Common.DebugTooltip(reason);
                    return(false);
                }

                if (sStoryProgressionAllowImpregnation.Valid && Woohooer.Settings.TestStoryProgression(isAutonomous))
                {
                    reason = sStoryProgressionAllowImpregnation.Invoke <string>(new object[] { sim.SimDescription, isAutonomous });

                    if (reason != null)
                    {
                        callback = Woohooer.StoryProgressionTooltip(reason, false);
                        return(false);
                    }
                }

                reason = null;

                return(true);
            }
        }
Ejemplo n.º 29
0
        public override bool Run()
        {
            try
            {
                if (!TimePortal.sTimeTravelerHasBeenSummoned && Actor.CreateRoute().PlanToSlot(Target, Slot.RoutingSlot_0).Succeeded())
                {
                    if (!TimeTravelerSituation.Create(Actor.LotHome, Actor.ObjectId, Target.ObjectId))
                    {
                        return(false);
                    }
                    CauseEffectService.OpportunityPortal = Target;
                    mTimeTravlerArrivalHandled           = false;
                }
                if ((Target.InUse && !Target.IsActorUsingMe(Actor)) || !Actor.RouteToSlot(Target, Slot.RoutingSlot_0, false))
                {
                    return(false);
                }
                if (Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                {
                    return(false);
                }

                Definition interactionDefinition = InteractionDefinition as Definition;
                if (Target.Active)
                {
                    interactionDefinition.curState = TimePortal.PortalState.Active;
                }
                else
                {
                    interactionDefinition.curState = TimePortal.PortalState.Inactive;
                }

                Actor.SkillManager.AddElement(SkillNames.Future);
                StandardEntry(!Target.IsActorUsingMe(Actor));
                BeginCommodityUpdates();
                Target.mTimeToStepBack = false;
                EnterStateMachine("timeportal", "Enter", "x");
                SetActor("portal", Target);
                mCurrentStateMachine.AddOneShotScriptEventHandler(0x65, SwitchActiveState);
                mCurrentStateMachine.AddOneShotScriptEventHandler(0x66, PositionTimeTraveler);
                AnimateSim("Mess With");
                if (!TimePortal.sTimeTravelerHasBeenSummoned)
                {
                    Common.DebugNotify("A");

                    mCurrentStateMachine.RequestState(false, "x", "FirstTimeReact");
                    emergencyStopWatch = StopWatch.Create(StopWatch.TickStyles.Seconds);
                    int num = 0x2d;

                    mTimeTraveler = CauseEffectService.GetInstance().GetTimeTraveler();
                    while ((mTimeTraveler == null) && (emergencyStopWatch.GetElapsedTime() < num))
                    {
                        SpeedTrap.Sleep(0x1);

                        // Custom
                        SimDescription simDesc = SimDescription.Find(CauseEffectService.sPersistableData.TimeTravelerSimID);
                        if (simDesc == null)
                        {
                            CauseEffectService.sPersistableData.TimeTravelerSimID = 0;
                            CauseEffectService.GetInstance().RequestTimeTravelerSimDesc(Household.NpcHousehold);
                        }
                        else
                        {
                            mTimeTraveler = Instantiation.PerformOffLot(simDesc, Target.LotCurrent, null);
                        }
                    }

                    Common.DebugNotify("B");

                    if (mTimeTraveler != null)
                    {
                        InteractionQueue interactionQueue = mTimeTraveler.InteractionQueue;
                        mLinkedInteraction            = TimePortal.BeSummoned.Singleton.CreateInstance(Actor, mTimeTraveler, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false) as TimePortal.BeSummoned;
                        mLinkedInteraction.SyncTarget = Actor;
                        interactionQueue.AddNext(mLinkedInteraction);
                        Actor.SynchronizationRole   = Sim.SyncRole.Initiator;
                        Actor.SynchronizationTarget = mTimeTraveler;
                        Actor.SynchronizationLevel  = Sim.SyncLevel.Routed;
                        if (Actor.WaitForSynchronizationLevelWithSim(mTimeTraveler, Sim.SyncLevel.Started, 40f))
                        {
                            Common.DebugNotify("C");

                            SetActorAndEnter("y", mTimeTraveler, "TTEnter");
                            AnimateJoinSims("TimeTravelerExit");
                            Actor.SynchronizationLevel = Sim.SyncLevel.Completed;

                            TimeTravelerSituation situation = ServiceSituation.FindServiceSituationInvolving(mTimeTraveler) as TimeTravelerSituation;
                            if (situation != null)
                            {
                                situation.OnAppearComplete(mTimeTraveler, 0f);

                                while (!Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                                {
                                    Actor.LoopIdle();
                                    SpeedTrap.Sleep(0xa);
                                }
                            }
                            else
                            {
                                Target.ActorsUsingMe.Clear();

                                TimePortal.sTimeTravelerHasBeenSummoned = true;
                            }
                        }
                        else
                        {
                            AnimateSim("Exit");
                        }

                        Common.DebugNotify("D");

                        mTimeTravlerArrivalHandled = true;
                    }
                    else
                    {
                        AnimateSim("Exit");
                    }
                }
                else
                {
                    if (!GameUtils.IsFutureWorld())
                    {
                        MiniSimDescription simDesc = MiniSimDescription.Find(CauseEffectService.sPersistableData.TimeTravelerSimID);
                        if (simDesc == null)
                        {
                            CauseEffectService.sPersistableData.TimeTravelerSimID = 0;
                            CauseEffectService.GetInstance().RequestTimeTravelerSimDesc(Household.NpcHousehold);
                        }
                    }

                    AnimateSim("Exit");
                    Vector3 v = Target.Position + ((Vector3)(2f * Target.ForwardVector));
                    Actor.RouteToPoint(v);
                    Actor.RouteTurnToFace(Target.Position);
                }

                EndCommodityUpdates(true);
                StandardExit();
                if (Target.Active)
                {
                    EventTracker.SendEvent(EventTypeId.kInspectedTimePortal, Actor);
                }

                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }
            finally
            {
                TravelUtil.PlayerMadeTravelRequest = false;
                //Sims3.Gameplay.Gameflow.Singleton.EnableSave(this);
            }

            return(false);
        }
Ejemplo n.º 30
0
        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;
            }
        }