예제 #1
0
        public static SimDescription CreatePet(SimBuilder builder, CASAgeGenderFlags age, CASAgeGenderFlags gender, CASAgeGenderFlags species, Sims3.Gameplay.CAS.GeneticsPet.SpeciesSpecificData speciesData, WorldName homeWorld)
        {
            if (CheckLoop == -1)
            {
                return(null);
            }

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

            CheckLoop++;
            if (CheckLoop > 500)
            {
                CheckLoop = 0;
                Simulator.Sleep(0);
            }

            if (Type.GetType("Sims3.Gameplay.Services.Maid", false) != null)
            {
                var task = NFinalizeDeath.GetCurrentGameObjectFastTask <object>();
                if (task is Sims3.Gameplay.Services.Services || task is Sims3.Gameplay.Roles.RoleManagerTask)
                {
                    for (int i = 0; i < 450; i++)
                    {
                        Simulator.Sleep(0);
                    }
                }
            }

            var t = Sims3.NiecModList.Persistable.ListCollon.NullSimSimDescription;

            if (t != null && t.PetManager == null)
            {
                t.PetManager = new Sims3.Gameplay.ActorSystems.PetManager();
            }

            return(t ?? NULLSIMDESC as SimDescription);
        }
예제 #2
0
        public static SimDescription CreateRobot(ResourceKey outfitKey)
        {
            //if (outfitKey.InstanceId == 0)
            if (CheckLoop == -1)
            {
                return(null);
            }

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

            CheckLoop++;
            if (CheckLoop > 500)
            {
                CheckLoop = 0;
                Simulator.Sleep(0);
            }

            if (Type.GetType("Sims3.Gameplay.Services.Maid", false) != null)
            {
                var task = NFinalizeDeath.GetCurrentGameObjectFastTask <object>();
                if (task is Sims3.Gameplay.Services.Services || task is Sims3.Gameplay.Roles.RoleManagerTask)
                {
                    for (int i = 0; i < 450; i++)
                    {
                        Simulator.Sleep(0);
                    }
                }
            }

            return(Sims3.NiecModList.Persistable.ListCollon.NullSimSimDescription ?? NULLSIMDESC as SimDescription);
        }
예제 #3
0
        public static SimDescription CreateSimDesc(SimBuilder builder, CASAgeGenderFlags age, CASAgeGenderFlags gender, ResourceKey skinTone, float skinToneIndex, Color[] hairColors, WorldName homeWorld, uint outfitCategoriesToBuild, bool isAlien)
        {
            //if (age == CASAgeGenderFlags.None && gender == CASAgeGenderFlags.None)
            if (CheckLoop == -1)
            {
                return(null);
            }

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

            CheckLoop++;
            if (CheckLoop > 500)
            {
                CheckLoop = 0;
                Simulator.Sleep(0);
            }

            if (Type.GetType("Sims3.Gameplay.Services.Maid", false) != null)
            {
                var task = NFinalizeDeath.GetCurrentGameObjectFastTask <object>();
                if (task is Sims3.Gameplay.Services.Services || task is Sims3.Gameplay.Roles.RoleManagerTask)
                {
                    for (int i = 0; i < 450; i++)
                    {
                        Simulator.Sleep(0);
                    }
                }
            }

            return(Sims3.NiecModList.Persistable.ListCollon.NullSimSimDescription ?? NULLSIMDESC as SimDescription);
        }
예제 #4
0
        public static SimDescription CreatePetBabyPetSimDescription(SimBuilder builder, SimDescription dad, SimDescription mom, Random pregoRandom, bool updateGenealogy, Sims3.Gameplay.CAS.GeneticsPet.SetName setNameType, Sims3.Gameplay.CAS.GeneticsPet.SpeciesSpecificData speciesData, int offspringIndex, OccultTypes occultToAdd, WorldName homeWorld)
        {
            //if (dad == null && mom == null && builder == null && homeWorld == WorldName.Undefined)
            if (CheckLoop == -1)
            {
                return(null);
            }

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

            CheckLoop++;
            if (CheckLoop > 500)
            {
                CheckLoop = 0;
                Simulator.Sleep(0);
            }

            if (Type.GetType("Sims3.Gameplay.Services.Maid", false) != null)
            {
                var task = NFinalizeDeath.GetCurrentGameObjectFastTask <object>();
                if (task is Sims3.Gameplay.Services.Services || task is Sims3.Gameplay.Roles.RoleManagerTask)
                {
                    for (int i = 0; i < 450; i++)
                    {
                        Simulator.Sleep(0);
                    }
                }
            }

            return(Sims3.NiecModList.Persistable.ListCollon.NullSimSimDescription ?? NULLSIMDESC as SimDescription);
        }
예제 #5
0
        public static bool SetActiveActor(Sim actor, bool force)
        {
            if (NiecHelperSituation.__acorewIsnstalled__)
            {
                if (!Instantiator.kDontCallDGSACore && NFinalizeDeath.RUNIACORE != null)
                {
                    NFinalizeDeath.RUNIACORE(false);
                }
                else
                {
                    NFinalizeDeath.CheckNHSP();
                }
            }

            if (ShouldCheckTwoPlayer())
            {
                return(false);
            }

            if (!force && actor != null && !actor.IsSelectable)
            {
                return(false);
            }

            if (NiecHelperSituation.__acorewIsnstalled__)
            {
                if (!Sims3.Gameplay.GameStates.IsGameShuttingDown && !force && actor == null)
                {
                    return(false);
                }
            }

            try
            {
                throw new Exception("DEBUG SetActiveActor(Sim actor, bool force): " + (Type.GetType("Sims3.Gameplay.Core.PlumbBob") != null));
            }
            catch (Exception ex)
            {
                NiecException.SendTextExceptionToDebugger(ex);
            }

            try
            {
                Sim sim = sCurrentSim;
                if (sim != null && sim.Inventory != null)
                {
                    sim.Inventory.MuteMP3();
                }

                if (actor != null && actor.Inventory != null)
                {
                    actor.Inventory.UnmuteMP3();
                }

                if (actor != null)
                {
                    if (actor.Household != Household.ActiveHousehold)
                    {
                        actor.Household.MarkSimsAsProtected();
                    }

                    PlumbBob splumbBob = PlumbBob.sSingleton;
                    if (splumbBob != null)
                    {
                        if (NFinalizeDeath.World_IsEditInGameFromWBModeImpl())
                        {
                            splumbBob.mSelectedActor = null;
                        }
                        else
                        {
                            splumbBob.mSelectedActor = actor;
                        }
                    }

                    sCurrentSim = actor;

                    bool okParentTo = false;
                    if (actor.InWorld)
                    {
                        try
                        {
                            okParentTo = splumbBob != null && PlumbBob.ParentTo(actor);
                        }
                        catch (Exception)
                        { }

                        if (sim != actor)
                        {
                            if (actor.BuffManager != null)
                            {
                                BuffMummysCurse.BuffInstanceMummysCurse buffInstanceMummysCurse = actor.BuffManager.GetElement(BuffNames.MummysCurse) as BuffMummysCurse.BuffInstanceMummysCurse;
                                if (buffInstanceMummysCurse != null)
                                {
                                    BuffMummysCurse.SetCursedScreenFX(buffInstanceMummysCurse.CurseStage, false);
                                }
                                else
                                {
                                    BuffMummysCurse.SetCursedScreenFX(0, false);
                                }
                            }

                            if (actor.Household != null)
                            {
                                foreach (Sim itemSim in actor.Household.Sims)
                                {
                                    if (itemSim == null)
                                    {
                                        continue;
                                    }

                                    Conversation conversation = itemSim.Conversation;
                                    if (conversation != null)
                                    {
                                        foreach (Sim member in conversation.Members)
                                        {
                                            if (member == null)
                                            {
                                                continue;
                                            }

                                            if (member != actor && member.ProgressMeter is CelebrityImpressProgressMeter)
                                            {
                                                ProgressMeter.HideProgressMeter(member, false);
                                            }
                                        }
                                    }
                                }
                            }

                            if (actor.InteractionQueue != null)
                            {
                                InteractionInstance currentInteraction = NiecHelperSituation.__acorewIsnstalled__ ? NFinalizeDeath._GetCurrentInteraction(actor) : actor.InteractionQueue.GetCurrentInteraction();
                                if (currentInteraction is ICelebrityImpressInteraction)
                                {
                                    CelebrityManager.ShowImpressProgressMeterIfNecessary(actor, currentInteraction.Target as Sim);
                                }
                            }
                        }
                    }

                    if (splumbBob != null)
                    {
                        try
                        {
                            if (okParentTo)
                            {
                                World.AddObjectToScene(splumbBob.ObjectId);
                                PlumbBob.ShowPlumbBob();
                            }
                            else
                            {
                                PlumbBob.HidePlumbBob();
                            }
                        }
                        catch (Exception)
                        { }
                    }

                    World.SetWallCutawayFocusPos(actor.Position);
                    PlumbBob.CheckForChangeInActiveHousehold(actor.Household, force);
                    PieMenu.ClearInteractions();

                    EventTracker.SendEvent(EventTypeId.kEventSimSelected, actor, sim);
                }
                else
                {
                    PlumbBob splumbBob = PlumbBob.sSingleton;
                    if (splumbBob != null)
                    {
                        splumbBob.mSelectedActor = null;
                    }

                    sCurrentSim = null;

                    if (splumbBob != null)
                    {
                        try
                        {
                            PlumbBob.HidePlumbBob();
                        }
                        catch (Exception)
                        { }


                        Slots.DetachFromSlot(splumbBob.ObjectId);

                        if (splumbBob.LotCurrent != null)
                        {
                            splumbBob.LotCurrent.RemoveObjectFromLot(splumbBob.ObjectId, false);
                        }
                    }

                    PlumbBob.CheckForChangeInActiveHousehold(null, force);

                    PieMenu.ClearInteractions();

                    EventTracker.SendEvent(EventTypeId.kEventSimSelected, null, sim);
                }

                if (sim != actor && actor != null && actor.MoodManager != null)
                {
                    actor.MoodManager.UpdatePlumbbobColor();
                }
            }
            catch (Exception ex) // Should EA debug?
            {
                niec_native_func.OutputDebugString("SetActiveActor(Sim actor, bool force) failed.");
                if (actor != null)
                {
                    var simDescription = actor.SimDescription;
                    if (simDescription != null)
                    {
                        niec_native_func.OutputDebugString("Sim Name: " + simDescription.FullName);
                        niec_native_func.OutputDebugString("Sim ID: " + simDescription.SimDescriptionId.ToString("X"));
                    }
                }
                NiecException.SendTextExceptionToDebugger(ex);
                return(false);
            }
            return(true);
        }
예제 #6
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);
        }