Ejemplo n.º 1
0
        public static void PackUpToMiniSimDescription(SimDescription ths)
        {
            if (ths.CreatedSim != null)
            {
                ths.CreatedSim.Destroy();
                Common.Sleep();
            }
            if (Find(ths.SimDescriptionId) != null)
            {
                SimDescription father = null;

                if (ths.Pregnancy != null)
                {
                    if ((ths.Pregnancy.mDad == null) || ths.Pregnancy.mDad.HasBeenDestroyed)
                    {
                        if (SimDescription.Find(ths.Pregnancy.DadDescriptionId) == null)
                        {
                            MiniSimDescription description = Find(ths.Pregnancy.DadDescriptionId);
                            if (description != null)
                            {
                                father = UnpackSim(description);
                                father.Genealogy.SetSimDescription(father);

                                Household.TouristHousehold.AddTemporary(father);
                            }
                        }
                    }
                }

                PackSim(ths);

                if (father != null)
                {
                    father.Dispose(true, true);
                }
            }
            else
            {
                MiniSimDescription.AddMiniSim(ths);
                ths.Household.RemoveTemporary(ths);

                MiniSimDescription miniSim;
                if (MiniSimDescription.sMiniSims.TryGetValue(ths.SimDescriptionId, out miniSim))
                {
                    GenerateCrossWorldThumbnail(miniSim, ths, true);
                }

                ths.Dispose(true, true);
            }

            ths.mPackingDescriptionTask = null;
            if (!GameStates.IsTravelling)
            {
                (Sims3.Gameplay.UI.Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).OnSimCurrentWorldChanged(false, ths);
            }

            ths.ClearOutfits(true);
        }
Ejemplo n.º 2
0
        public new void CreateBabyBeforePacking()
        {
            if (GameUtils.IsOnVacation() || GameUtils.IsUniversityWorld())
            {
                if (mMom.Household != null)
                {
                    int numSims = 0;
                    int numPets = 0;
                    mMom.Household.GetNumberOfSimsAndPets(true, out numSims, out numPets);
                    List <SimDescription> list = CreateNewbornsBeforePacking(0f, true, numSims, numPets);

                    foreach (SimDescription current in list)
                    {
                        MiniSimDescription.AddMiniSim(current);
                    }

                    mMom.Household.InvalidateThumbnail();
                    List <SimDescription> allDescriptions = mMom.Household.AllSimDescriptions;

                    foreach (SimDescription current2 in allDescriptions)
                    {
                        MiniSimDescription miniSimDescription = MiniSimDescription.Find(current2.SimDescriptionId);

                        if (miniSimDescription != null)
                        {
                            miniSimDescription.UpdateHouseholdMembers(allDescriptions);
                        }
                    }

                    Simulator.Sleep(0u);
                }
            }
            else
            {
                MiniSimDescription miniSimDescription2 = MiniSimDescription.Find(mMom.SimDescription.SimDescriptionId);

                if (miniSimDescription2 != null)
                {
                    int          numSims2 = 1;
                    int          numPets2 = 0;
                    List <ulong> list2    = new List <ulong>();

                    if (miniSimDescription2.HouseholdMembers != null)
                    {
                        numSims2 = miniSimDescription2.NumSimMemberIncludingPregnant;
                        numPets2 = miniSimDescription2.NumPetMemberIncludingPregnant;
                        list2.AddRange(miniSimDescription2.HouseholdMembers);
                    }
                    else
                    {
                        list2.Add(miniSimDescription2.SimDescriptionId);
                    }

                    List <SimDescription> list3 = CreateNewbornsBeforePacking(0f, false, numSims2, numPets2);

                    while (list3.Count > 0)
                    {
                        SimDescription description = list3[0];
                        MiniSimDescription.AddMiniSim(description);
                        MiniSimDescription miniSimDescription3 = MiniSimDescription.Find(description.SimDescriptionId);
                        miniSimDescription3.mMotherDescId = miniSimDescription2.SimDescriptionId;
                        list2.Add(description.SimDescriptionId);
                        list3.RemoveAt(0);
                        description.Dispose();
                    }

                    foreach (ulong current3 in list2)
                    {
                        MiniSimDescription miniSimDescription4 = MiniSimDescription.Find(current3);

                        if (miniSimDescription4 != null)
                        {
                            miniSimDescription4.UpdateHouseholdMembers(list2);
                        }
                    }
                }
            }

            mMom.SimDescription.ClearPregnancyData();

            if (!mMom.HasBeenDestroyed)
            {
                mMom.SwitchToOutfitWithoutSpin(OutfitCategories.Everyday);
            }
        }
Ejemplo n.º 3
0
        private static void CreateBabyBeforePacking(Pregnancy ths)
        {
            try
            {
                Sim mom = ths.Mom;
                if (mom == null)
                {
                    return;
                }

                if ((GameUtils.IsOnVacation()) || (GameUtils.IsUniversityWorld()))
                {
                    Household household = mom.Household;
                    if (household != null)
                    {
                        int simCount = 0x0;
                        int petCount = 0x0;
                        household.GetNumberOfSimsAndPets(true, out simCount, out petCount);

                        foreach (SimDescription description in CreateNewbornsBeforePacking(ths, 0f, true, simCount, petCount))
                        {
                            MiniSimDescription.AddMiniSim(description);
                        }

                        household.InvalidateThumbnail();

                        List <SimDescription> simDescriptions = household.AllSimDescriptions;
                        foreach (SimDescription description2 in simDescriptions)
                        {
                            MiniSimDescription description3 = Find(description2.SimDescriptionId);
                            if (description3 != null)
                            {
                                description3.UpdateHouseholdMembers(simDescriptions);
                            }
                        }

                        Common.Sleep();
                    }
                }
                else
                {
                    MiniSimDescription description4 = Find(mom.SimDescription.SimDescriptionId);
                    if (description4 != null)
                    {
                        int          householdSimMembers = 0x1;
                        int          householdPetMembers = 0x0;
                        List <ulong> currentMembers      = new List <ulong>();
                        if (description4.HouseholdMembers != null)
                        {
                            householdSimMembers = description4.NumSimMemberIncludingPregnant;
                            householdPetMembers = description4.NumPetMemberIncludingPregnant;
                            currentMembers.AddRange(description4.HouseholdMembers);
                        }
                        else
                        {
                            currentMembers.Add(description4.SimDescriptionId);
                        }

                        List <SimDescription> list4 = CreateNewbornsBeforePacking(ths, 0f, false, householdSimMembers, householdPetMembers);
                        while (list4.Count > 0x0)
                        {
                            SimDescription desc = list4[0x0];
                            list4.RemoveAt(0x0);

                            if (desc != null)
                            {
                                MiniSimDescription.AddMiniSim(desc);

                                MiniSimDescription miniSim = Find(desc.SimDescriptionId);
                                if (miniSim != null)
                                {
                                    miniSim.mMotherDescId = description4.SimDescriptionId;
                                }

                                currentMembers.Add(desc.SimDescriptionId);
                                desc.Dispose();
                            }
                        }

                        foreach (ulong num2 in currentMembers)
                        {
                            MiniSimDescription description7 = Find(num2);
                            if (description7 != null)
                            {
                                description7.UpdateHouseholdMembers(currentMembers);
                            }
                        }
                    }
                }

                if (mom.SimDescription != null)
                {
                    mom.SimDescription.ClearPregnancyData();

                    if (!mom.HasBeenDestroyed)
                    {
                        mom.SwitchToOutfitWithoutSpin(OutfitCategories.Everyday);
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(ths.mMom, ths.mDad, e);
            }
        }
Ejemplo n.º 4
0
        public new void CreateBabyBeforePacking()
        {
            if (GameUtils.IsOnVacation() || GameUtils.IsUniversityWorld())
            {
                if (mMom.Household != null)
                {
                    int numSims = 0, numPets = 0;
                    mMom.Household.GetNumberOfSimsAndPets(true, out numSims, out numPets);
                    List <SimDescription> list = CreateNewbornsBeforePacking(0f, true, numSims, numPets);

                    foreach (SimDescription current in list)
                    {
                        MiniSimDescription.AddMiniSim(current);
                    }

                    mMom.Household.InvalidateThumbnail();
                    List <SimDescription> allDescriptions = mMom.Household.AllSimDescriptions;

                    foreach (SimDescription current2 in allDescriptions)
                    {
                        MiniSimDescription miniSimDescription = MiniSimDescription.Find(current2.SimDescriptionId);

                        if (miniSimDescription != null)
                        {
                            miniSimDescription.UpdateHouseholdMembers(allDescriptions);
                        }
                    }

                    Simulator.Sleep(0u);
                }
            }
            else
            {
                MiniSimDescription miniSimDescription = MiniSimDescription.Find(RobotMomDescriptionID);

                if (miniSimDescription != null)
                {
                    int          numSims = 1, numPets = 0;
                    List <ulong> list = new List <ulong>();

                    if (miniSimDescription.HouseholdMembers != null)
                    {
                        numSims = miniSimDescription.NumSimMemberIncludingPregnant;
                        numPets = miniSimDescription.NumPetMemberIncludingPregnant;
                        list.AddRange(miniSimDescription.HouseholdMembers);
                    }
                    else
                    {
                        list.Add(miniSimDescription.SimDescriptionId);
                    }

                    List <SimDescription> newborns = CreateNewbornsBeforePacking(0f, false, numSims, numPets);

                    while (newborns.Count > 0)
                    {
                        SimDescription simDescription = newborns[0];
                        MiniSimDescription.AddMiniSim(simDescription);
                        MiniSimDescription miniSimDescription2 = MiniSimDescription.Find(simDescription.SimDescriptionId);
                        miniSimDescription2.mMotherDescId = miniSimDescription.SimDescriptionId;
                        list.Add(simDescription.SimDescriptionId);
                        newborns.RemoveAt(0);
                        simDescription.Dispose();
                    }

                    foreach (ulong current3 in list)
                    {
                        MiniSimDescription miniSimDescription4 = MiniSimDescription.Find(current3);

                        if (miniSimDescription4 != null)
                        {
                            miniSimDescription4.UpdateHouseholdMembers(list);
                        }
                    }
                }
            }

            mMom.SimDescription.ClearPregnancyData();
        }