Exemplo n.º 1
0
        public override bool Run()
        {
            Actor.SimDescription.Pregnancy.mHasShownPregnancy = true;

            if (Actor.IsSelectable)
            {
                PlumbBob.SelectActor(Actor);
                Camera.FocusOnSim(Actor, Pregnancy.kShowPregnancyCameraLerp.Zoom, Pregnancy.kShowPregnancyCameraLerp.Pitch,
                                  Pregnancy.kShowPregnancyCameraLerp.Time, true, false);
                Audio.StartSound("sting_alien_visit");
                //Audio.StartObjectSound(Actor.ObjectId, "sting_alien_visit", false);
            }

            Actor.SimDescription.ShowPregnancy();
            Actor.BuffManager.AddElement(BuffsAndTraits.sXenogenesis, Origin.FromPregnancy);

            if (Actor.BuffManager.HasElement(BuffNames.Nauseous))
            {
                Actor.BuffManager.GetElement(BuffNames.Nauseous).mBuffOrigin = Origin.FromPregnancy;
            }

            ActiveTopic.AddToSim(Actor, "Announce Pregnancy");
            Actor.SimDescription.Pregnancy.TryToGiveLeave();
            Tutorialette.TriggerLesson(Lessons.Pregnancy, Actor);
            Actor.PlaySoloAnimation("a_alien_pregnancy_inspectStomach", true);

            if (Actor.Occupation != null)
            {
                Actor.Occupation.RemoveAllJobs();
            }

            return(true);
        }
Exemplo n.º 2
0
        public override bool Run()
        {
            if (Actor.IsSelectable)
            {
                PlumbBob.SelectActor(Actor);
                Camera.FocusOnSim(Actor, Pregnancy.kShowPregnancyCameraLerp.Zoom, Pregnancy.kShowPregnancyCameraLerp.Pitch,
                                  Pregnancy.kShowPregnancyCameraLerp.Time, true, false);
                Audio.StartSound("sting_alien_visit");
            }

            Actor.SimDescription.ShowPregnancy();
            Actor.BuffManager.AddElement(AlienUtilsEx.sXenogenesis, Origin.FromPregnancy);
            ActiveTopic.AddToSim(Actor, "Announce Pregnancy");

            /* TODO------------------------------------------------ */
            /* Set alarm to give leave at start of third trimester! */
            /* ---------------------------------------------------- */

            Tutorialette.TriggerLesson(Lessons.Pregnancy, Actor);
            Actor.PlaySoloAnimation("a_alien_pregnancy_inspectStomach");

            /* TODO------------------------------ */
            /* Will not remove jobs at this time! */
            /* ---------------------------------- */

            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Reset the apartment lot and combine families
        /// </summary>
        /// <param name="c"></param>
        public static void ResetLot(Controller c)
        {
            //Reset families
            foreach (ApartmentFamily f in c.Families)
            {
                if (!f.IsActive)
                {
                    foreach (SimDescription s in f.Residents)
                    {
                        RemoveRoommate(s);
                    }

                    c.LotCurrent.Household.SetFamilyFunds(c.LotCurrent.Household.FamilyFunds + f.FamilyFunds);
                }
            }
            c.Families = new List <ApartmentFamily>();

            //Select the first sim in the active household
            if (c.LotCurrent != null && c.LotCurrent.Household != null && c.LotCurrent.Household.Sims != null && c.LotCurrent.Household.Sims.Count > 0)
            {
                PlumbBob.SelectActor(c.LotCurrent.Household.Sims[0]);
            }
        }
Exemplo n.º 4
0
        private new void SpawnOffspring()
        {
            Pregnancy pregnancy    = Actor.SimDescription.Pregnancy;
            Sim       dad          = pregnancy.Dad;
            bool      isSelectable = Actor.IsSelectable;

            if (isSelectable)
            {
                PlumbBob.SelectActor(Actor);
                Camera.LerpParams kShowPetPregnancyCameraLerp = PetPregnancy.kShowPetPregnancyCameraLerp;
                Camera.FocusOnSim(Actor, kShowPetPregnancyCameraLerp.Zoom, kShowPetPregnancyCameraLerp.Pitch, kShowPetPregnancyCameraLerp.Time, true, false);
                BuffNames newKittensHuman = BuffNames.NewKittensHuman;
                Origin    fromNewLitter   = Origin.FromNewLitter;
                if (Actor.IsHorse)
                {
                    newKittensHuman = BuffNames.NewFoalHuman;
                    fromNewLitter   = Origin.FromNewFoal;
                }
                else if (Actor.IsADogSpecies)
                {
                    newKittensHuman = BuffNames.NewPuppiesHuman;
                }
                PetPregnancy.ReactToPetBirthHelper helper = new PetPregnancy.ReactToPetBirthHelper(newKittensHuman, fromNewLitter, Actor.Household.HouseholdId);
                new Sim.Celebrate.Event(Actor, null, PetPregnancy.kHadLitterCelebrationWitnessTuning, PetPregnancy.kHadLitterCelebrationBroadcasterParams, null, new Callback(helper.OnLitterCelebrationStarted));
                Audio.StartObjectSound(Actor.ObjectId, "sting_pet_baby_born", false);
            }
            else
            {
                try
                {
                    Simulator.YieldingDisabled = true;

                    // Custom
                    HaveBabyHomeEx.EnsureForeignFather(pregnancy);

                    // Custom
                    mOffspring = new Proxies.PetPregnancyProxy(pregnancy).CreateNewborns(0f, isSelectable, true);
                }
                finally
                {
                    Simulator.YieldingDisabled = false;
                }
            }

            Actor.SimDescription.SetPetPregnant(false);
            string effectName = "ep5birthfoalconfetti";
            int    count      = mOffspring.Count;

            if (Actor.IsCat)
            {
                if (count == 0x1)
                {
                    Actor.ShowTNSIfSelectable(TNSNames.PetPregnancyCatSingleKittenTNS, null, Actor, new object[] { Actor });
                }
                else
                {
                    Actor.ShowTNSIfSelectable(TNSNames.PetPregnancyCatHadLitterTNS, null, Actor, new object[] { Actor, count });
                }
                effectName = "ep5birthkittenconfetti";
            }
            else if (Actor.IsADogSpecies)
            {
                if (count == 0x1)
                {
                    Actor.ShowTNSIfSelectable(TNSNames.PetPregnancyDogSinglePuppyTNS, null, Actor, new object[] { Actor });
                }
                else
                {
                    Actor.ShowTNSIfSelectable(TNSNames.PetPregnancyDogHadLitterTNS, null, Actor, new object[] { Actor, count });
                }
                effectName = "ep5birthpuppyconfetti";
            }

            foreach (Sim sim2 in mOffspring)
            {
                Relationship.Get(Actor, sim2, true).LTR.UpdateLiking(RandomUtil.GetFloat(kInitialChildParentRelLikingRange[0x0], kInitialChildParentRelLikingRange[0x1]));
                if (dad != null)
                {
                    Relationship relationship2 = Relationship.Get(dad, sim2, true);
                    if (relationship2 != null)
                    {
                        relationship2.LTR.UpdateLiking(RandomUtil.GetFloat(kInitialChildParentRelLikingRange[0x0], kInitialChildParentRelLikingRange[0x1]));
                    }
                }
                if (isSelectable)
                {
                    sim2.SimDescription.IsNeverSelectable = false;
                }
                Pregnancy.MakeBabyVisible(sim2);
                VisualEffect effect = VisualEffect.Create(effectName);
                effect.SetPosAndOrient(Slots.GetPositionOfSlot(sim2.ObjectId, (uint)Sim.FXJoints.Spine0), -sim2.ForwardVector, Slots.GetUpOfSlot(sim2.ObjectId, Sim.FXJoints.Spine0));
                effect.SubmitOneShotEffect(VisualEffect.TransitionType.SoftTransition);
            }
        }
Exemplo n.º 5
0
            public static bool PerformImmediate(Sim sim, bool allowHouseholdSwitch, bool catchDreams, bool forceFull)
            {
                bool success = false;

                Common.StringBuilder msg = new Common.StringBuilder("DreamCatcher: " + sim.FullName + Common.NewLine);

                try
                {
                    msg += "A";

                    if ((!forceFull) && (PlumbBob.sCurrentNonNullHousehold != null) && (PlumbBob.sCurrentNonNullHousehold == sim.Household))
                    {
                        msg += "B";

                        if (PlumbBob.SelectedActor == sim)
                        {
                            return(true);
                        }

                        msg += "C";

                        using (SafeStore store = new SafeStore(sim.SimDescription, SafeStore.Flag.Selectable | SafeStore.Flag.Unselectable | SafeStore.Flag.StoreOpportunities))
                        {
                            if (PlumbBob.SelectActor(sim))
                            {
                                return(true);
                            }

                            msg += "C2";

                            return(false);
                        }
                    }

                    msg += "D";

                    if (!allowHouseholdSwitch)
                    {
                        return(false);
                    }

                    msg += "E";

                    if (GameUtils.IsInstalled(ProductVersion.EP5))
                    {
                        PetAdoption.RemoveNeighborAdoptionOnHousehold(sim.Household.LotHome);
                    }

                    if (sim.Posture == null)
                    {
                        sim.Posture = null; // Resets to Standing
                    }

                    using (HouseholdStore store = new HouseholdStore(sim.Household, catchDreams))
                    {
                        if (sim.Household.LotHome != null)
                        {
                            PrepareToBecomeActiveHousehold(sim.Household);
                        }

                        foreach (SimDescription member in sim.Household.AllSimDescriptions)
                        {
                            if (member.GetMiniSimForProtection() == null)
                            {
                                MiniSimDescription miniSim;
                                if (MiniSimDescription.sMiniSims.TryGetValue(member.SimDescriptionId, out miniSim))
                                {
                                    miniSim.mHomeWorld = WorldName.UserCreated;
                                }
                            }
                        }

                        Sim previousSim = Sim.ActiveActor;

                        try
                        {
                            success = PlumbBob.ForceSelectActor(sim);
                        }
                        catch (Exception exception)
                        {
                            Common.Exception(sim, exception);

                            if (previousSim != null)
                            {
                                PlumbBob.ForceSelectActor(previousSim);
                            }
                        }
                    }

                    msg += "F " + success;

                    if ((MapTagManager.ActiveMapTagManager != null) && (sim.LotHome != null))
                    {
                        MapTagManager.ActiveMapTagManager.Reset();
                    }
                }
                catch (Exception e)
                {
                    Common.Exception(sim, e);
                }
                finally
                {
                    //Common.DebugNotify(msg);
                }

                return(success);
            }
Exemplo n.º 6
0
        public override bool Run()
        {
            string msg = "Run";

            checked
            {
                try
                {
                    if (AcceptCancelDialog.Show("Force Select Actor?"))
                    {
                        msg = "Accept";
                        var         definition   = base.InteractionDefinition as Definition;
                        LotLocation lotLocation  = default(LotLocation);
                        ulong       lotLocation2 = World.GetLotLocation(this.Hit.mPoint, ref lotLocation);
                        Lot         lot          = LotManager.GetLot(lotLocation2);
                        if ((definition.Age & (CASAgeGenderFlags.Baby | CASAgeGenderFlags.Toddler | CASAgeGenderFlags.Child)) != CASAgeGenderFlags.None)
                        {
                            bool flag = false;
                            if (lot != null && lot.Household != null)
                            {
                                foreach (SimDescription simDescription in lot.Household.SimDescriptions)
                                {
                                    if (simDescription.TeenOrAbove)
                                    {
                                        flag = true;
                                        break;
                                    }
                                }
                            }
                            if (!flag)
                            {
                                if (AssemblyCheckByNiec.IsInstalled("DGSCore") && TwoButtonDialog.Show("DGSCore" + NiecMod.Nra.NiecException.NewLine + "Found Childern Sims in Household Without Adult" + NiecMod.Nra.NiecException.NewLine + "Note: Social Worker Catch Remove Sims" + NiecMod.Nra.NiecException.NewLine + "Are you sure?!", "Yea It Create " + definition.Age, "No Create YoungAdult"))
                                {
                                    msg = "Accept if not flag";
                                    Sim simnocheck = DGSMakeRandomSimNoCheck(Hit.mPoint, definition.Age, definition.Gender, definition.WorldName);
                                    if (simnocheck != null)
                                    {
                                        if (simnocheck.IsSelectable)
                                        {
                                            PlumbBob.SelectActor(simnocheck);
                                        }
                                        else
                                        {
                                            simnocheck.SimDescription.IsNeverSelectable = false;
                                            PlumbBob.ForceSelectActor(simnocheck);
                                        }
                                        try
                                        {
                                            GlobalFunctions.PlaceAtGoodLocation(simnocheck, new World.FindGoodLocationParams(Hit.mPoint), false);
                                            if (simnocheck.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                            {
                                                simnocheck.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                                simnocheck.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                            }
                                        }
                                        catch
                                        { }

                                        try
                                        {
                                            if (simnocheck.SimDescription.Household.mName == null)
                                            {
                                                simnocheck.SimDescription.Household.SetName(simnocheck.SimDescription.LastName);
                                            }
                                        }
                                        catch (Exception ex2)
                                        {
                                            NiecMod.Nra.NiecException.WriteLog(msg + " SetName: " + NiecMod.Nra.NiecException.NewLine + NiecMod.Nra.NiecException.LogException(ex2), true, true);
                                        }
                                    }
                                    else
                                    {
                                        //return false;
                                        msg = "MakeSim Failed! if flag";
                                        goto backif;
                                    }
                                    return(true);
                                }
backif:
                                Sim sim = DGSMakeRandomSim(this.Hit.mPoint, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Male, definition.WorldName);
                                msg     = "Terraininstance";
                                if (sim != null)
                                {
                                    Sitoat    = true;
                                    mSima     = sim;
                                    mSimaStat = sim.SimDescription;
                                    sim.FadeOut();
                                    var terraininstance = new Terrain.TeleportMeHere.Definition(false).CreateInstance(Terrain.Singleton, sim, new InteractionPriority((InteractionPriorityLevel)8195), base.Autonomous, base.CancellableByPlayer) as TerrainInteraction;

                                    try
                                    {
                                        if (sim.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                        {
                                            sim.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                            sim.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                        }
                                    }
                                    catch
                                    { }

                                    if (terraininstance != null)
                                    {
                                        terraininstance.Hidden  = true;
                                        terraininstance.MustRun = true;
                                        //Vector3 vector2;
                                        Lot loty = sim.SimDescription.LotHome;
                                        if (loty == null)
                                        {
                                            loty = sim.SimDescription.VirtualLotHome;
                                        }
                                        //World.FindGoodLocationParams fglParams = new World.FindGoodLocationParams(Helper.Create.GetPositionInRandomLot(loty));

                                        /*
                                         * fglParams.BooleanConstraints |= FindGoodLocationBooleans.StayInRoom;
                                         * fglParams.InitialSearchDirection = RandomUtil.GetInt(0x0, 0x7);
                                         */
                                        //lot.Household.Add(sim.SimDescription);
                                        terraininstance.Destination = Helpers.Create.GetPositionInRandomLot(loty);
                                        sim.InteractionQueue.Add(terraininstance);
                                    }
                                }
                                else
                                {
                                    return(false);
                                }
                                try
                                {
                                    //sim.SimDescription.Household.SetName(/* "E3Lesa is Good" */ "Good Household");
                                    sim.SimDescription.Household.SetName(sim.SimDescription.LastName);
                                }
                                catch (Exception ex2)
                                {
                                    NiecMod.Nra.NiecException.WriteLog(msg + " SetName: " + NiecMod.Nra.NiecException.NewLine + NiecMod.Nra.NiecException.LogException(ex2), true, true);
                                }
                            }
                        }

                        //lot.MoveIn(lot.Household);
                        //FixFoxNonStaticDGSMakeRandomSim = true;
                        Sim sim2 = DGSMakeRandomSim(this.Hit.mPoint, definition.Age, definition.Gender, definition.WorldName);
                        if (sim2 != null)
                        {
                            PlumbBob.ForceSelectActor(sim2);
                            if (mSima != null && Sitoat)
                            {
                                var followchildsim = Sims3.Gameplay.Actors.Sim.FollowParent.Singleton.CreateInstance(sim2, mSima, new InteractionPriority((InteractionPriorityLevel)8195), base.Autonomous, base.CancellableByPlayer) as Sims3.Gameplay.Actors.Sim.FollowParent;
                                followchildsim.Hidden  = true;
                                followchildsim.MustRun = true;
                                if (mSima.InteractionQueue.AddNextIfPossibleAfterCheckingForDuplicates(followchildsim))
                                {
                                    Sim.ForceSocial(mSima, sim2, "Chat", (InteractionPriorityLevel)8195, true);
                                }

                                //sim2.SimDescription.TraitManager.RemoveAllElements();
                                try
                                {
                                    if (sim2.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                    {
                                        sim2.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                        sim2.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                    }
                                }
                                catch
                                { }
                            }
                        }
                    }



                    else
                    {
                        msg = "Cancel";
                        var definition = base.InteractionDefinition as Definition;
                        Sim sim3       = DGSMakeRandomSim(this.Hit.mPoint, definition.Age, definition.Gender, definition.WorldName);
                        if (sim3 == null)
                        {
                            msg = "Sim3 is Null";
                            Sim sim4 = DGSMakeRandomSim(this.Hit.mPoint, CASAgeGenderFlags.YoungAdult, CASAgeGenderFlags.Male, definition.WorldName);
                            if (sim4 != null)
                            {
                                msg = "Sim4 is Keep";


                                if (!sim4.IsInActiveHousehold)
                                {
                                    try
                                    {
                                        if (sim4.SimDescription.Household.NameUnlocalized == "Good Household")
                                        {
                                            sim4.SimDescription.Household.SetName("Evil Household");
                                        }
                                        else
                                        {
                                            sim4.SimDescription.Household.SetName(sim4.LastName);
                                        }
                                        sim4.SimDescription.TraitManager.RemoveAllElements();
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.Daredevil);
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                        sim4.SimDescription.TraitManager.AddElement(TraitNames.Adventurous);
                                    }
                                    catch
                                    { }
                                }
                                else
                                {
                                    try
                                    {
                                        if (sim4.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                        {
                                            sim4.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                            sim4.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                        }
                                    }
                                    catch
                                    { }

                                    if (sim4.SimDescription.Household.NameUnlocalized == "Evil Household")
                                    {
                                        sim4.SimDescription.Household.SetName("Good Household");
                                    }
                                    else
                                    {
                                        sim4.SimDescription.Household.SetName(sim4.LastName);
                                    }
                                }



                                Sim sim5 = DGSMakeRandomSim(this.Hit.mPoint, definition.Age, definition.Gender, definition.WorldName);
                                if (sim5 != null)
                                {
                                    msg = "Sim5 is Keep";
                                    GlobalFunctions.PlaceAtGoodLocation(sim5, new World.FindGoodLocationParams(Hit.mPoint), false);

                                    if (!sim5.IsInActiveHousehold)
                                    {
                                        try
                                        {
                                            if (sim5.SimDescription.Household.NameUnlocalized == "Good Household")
                                            {
                                                sim5.SimDescription.Household.SetName("Evil Household");
                                            }
                                            else
                                            {
                                                sim5.SimDescription.Household.SetName(sim5.LastName);
                                            }
                                            if (definition.Gender == CASAgeGenderFlags.Child)
                                            {
                                                sim5.SimDescription.TraitManager.RemoveAllElements();
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                            }
                                            else
                                            {
                                                sim5.SimDescription.TraitManager.RemoveAllElements();
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Daredevil);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Adventurous);
                                            }
                                        }
                                        catch
                                        { }
                                    }
                                    else
                                    {
                                        try
                                        {
                                            if (sim5.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                            {
                                                sim5.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                                sim5.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                            }
                                        }
                                        catch
                                        { }


                                        if (sim5.SimDescription.Household.NameUnlocalized == "Evil Household")
                                        {
                                            sim5.SimDescription.Household.SetName("Good Household");
                                        }
                                        else
                                        {
                                            sim5.SimDescription.Household.SetName(sim5.LastName);
                                        }
                                    }
                                }
                                else
                                {
                                    return(false);
                                }
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (!sim3.IsInActiveHousehold)
                            {
                                try
                                {
                                    if (sim3.SimDescription.Household.NameUnlocalized == "Good Household")
                                    {
                                        sim3.SimDescription.Household.SetName("Evil Household");
                                    }

                                    else
                                    {
                                        sim3.SimDescription.Household.SetName(sim3.LastName);
                                    }

                                    if (definition.Gender == CASAgeGenderFlags.Child)
                                    {
                                        sim3.SimDescription.TraitManager.RemoveAllElements();
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                    }
                                    else
                                    {
                                        sim3.SimDescription.TraitManager.RemoveAllElements();
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Daredevil);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Evil);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.MeanSpirited);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Loser);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Adventurous);
                                    }
                                }
                                catch
                                { }
                            }
                            else
                            {
                                try
                                {
                                    if (sim3.SimDescription.TraitManager.HasElement(TraitNames.Evil))
                                    {
                                        sim3.SimDescription.TraitManager.RemoveElement(TraitNames.Evil);
                                        sim3.SimDescription.TraitManager.AddElement(TraitNames.Good);
                                    }
                                }
                                catch
                                { }


                                if (sim3.SimDescription.Household.NameUnlocalized == "Evil Household")
                                {
                                    sim3.SimDescription.Household.SetName("Good Household");
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    NiecMod.Nra.NiecException.WriteLog(msg + " DGSMakeSim: " + NiecMod.Nra.NiecException.NewLine + NiecMod.Nra.NiecException.LogException(ex), true, true);
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 7
0
        public static void DisplayDialog(SimDescription actor, Household target, bool allowHorse)
        {
            List <SimDescription> pets = new List <SimDescription>();

            foreach (SimDescription pet in Households.Pets(actor.Household))
            {
                if (target != null)
                {
                    int price = GetPrice(pet);

                    if (price == 0)
                    {
                        continue;
                    }

                    if (target.FamilyFunds < price)
                    {
                        continue;
                    }
                }

                pets.Add(pet);
            }

            while (true)
            {
                string title    = Common.Localize("PetSelection:Title");
                int    maxPrice = int.MaxValue;

                if (target != null)
                {
                    title    = target.Name + Common.NewLine + Common.Localize("SellPet:Funds", false, new object[] { target.FamilyFunds });
                    maxPrice = target.FamilyFunds;
                }

                PetSelection.Results results = new PetSelection(actor, title, maxPrice, pets).SelectMultiple((target != null) ? 1 : 0);
                if ((results == null) || (results.Count == 0))
                {
                    return;
                }

                if (actor.CreatedSim != null)
                {
                    PlumbBob.SelectActor(actor.CreatedSim);
                }

                foreach (SimDescription sim in results)
                {
                    if ((target == null) && (sim.IsHorse) && (!allowHorse))
                    {
                        Common.Notify(sim.CreatedSim, Common.Localize("SellPet:WrongSpecies", sim.IsFemale, new object[] { sim }));
                    }
                    else if (Relationships.GetParents(sim).Count < 0)
                    {
                        Common.Notify(sim.CreatedSim, Common.Localize("SellPet:NoPedigree", sim.IsFemale, new object[] { sim }));
                    }
                    else
                    {
                        int price = GetPrice(sim);
                        if (price > maxPrice)
                        {
                            price = maxPrice;
                        }

                        if (price == 0)
                        {
                            Common.Notify(sim.CreatedSim, Common.Localize("SellPet:NoPrice", sim.IsFemale, new object[] { sim }));
                        }
                        else
                        {
                            actor.ModifyFunds(price);

                            Common.Notify(sim.CreatedSim, Common.Localize("SellPet:Success", sim.IsFemale, new object[] { sim, price }));

                            actor.Household.Remove(sim);

                            pets.Remove(sim);

                            Household choice = target;
                            if (choice == null)
                            {
                                List <Household> choices = new List <Household>();

                                foreach (Household house in Household.GetHouseholdsLivingInWorld())
                                {
                                    if (house == actor.Household)
                                    {
                                        continue;
                                    }

                                    if (!house.CanAddSpeciesToHousehold(sim.Species))
                                    {
                                        continue;
                                    }

                                    if (house.FamilyFunds < price)
                                    {
                                        continue;
                                    }

                                    choices.Add(house);
                                }

                                if (choices.Count > 0)
                                {
                                    choice = RandomUtil.GetRandomObjectFromList(choices);
                                }
                            }

                            if (choice != null)
                            {
                                choice.ModifyFamilyFunds(-price);

                                choice.Add(sim);

                                sim.LastName = SimTypes.HeadOfFamily(choice).LastName;

                                Instantiation.AttemptToPutInSafeLocation(sim.CreatedSim, false);
                            }
                            else
                            {
                                sim.Dispose(true);
                            }
                        }
                    }
                }

                if (target == null)
                {
                    break;
                }
            }
        }