Ejemplo n.º 1
0
        /// <summary>
        /// Switch the active family
        /// </summary>
        /// <param name="family"></param>
        /// <param name="isActive"></param>
        private static void SwitchActive(ApartmentFamily family, bool isActive)
        {
            if (isActive)
            {
                foreach (SimDescription s in family.Residents)
                {
                    //If this is true, this sim is a roommate
                    if (s.IsNeverSelectable)
                    {
                        RemoveRoommate(s);
                    }
                }

                foreach (MinorPet p in family.MinorPets)
                {
                    p.StartBehaviorSMC(true);
                }
            }
            else
            {
                foreach (SimDescription s in family.Residents)
                {
                    AddRoommate(s);
                }

                foreach (MinorPet p in family.MinorPets)
                {
                    p.StopBehaviorSMC();
                }
            }
        }
Ejemplo n.º 2
0
        public static void LoadActiveHousehold(ApartmentFamily activeFamily, Controller c)
        {
            try
            {
                //Clean the families first
                CleanupFamily(c);

                //Change active families
                int currentFunds       = c.LotCurrent.Household.FamilyFunds;
                int currentUnpaidBills = c.LotCurrent.Household.UnpaidBills;

                //Handle the new active family first
                foreach (ApartmentFamily f in c.Families)
                {
                    if (f.FamilyId == activeFamily.FamilyId)
                    {
                        f.IsActive = true;
                        c.LotCurrent.Household.SetFamilyFunds(f.FamilyFunds);
                        c.LotCurrent.Household.UnpaidBills = f.UnpaidBills;
                        ApartmentController.SwitchActive(f, true);

                        break;
                    }
                }

                //Select the first sim in the active household
                if (activeFamily.Residents.Count > 0 && c.LotCurrent.Household.IsActive)
                {
                    PlumbBob.ForceSelectActor(activeFamily.Residents[0].CreatedSim);
                }

                //Make everybody else roommates
                foreach (ApartmentFamily f in c.Families)
                {
                    if (f.FamilyId != activeFamily.FamilyId)
                    {
                        //If this is the previous active family
                        if (f.IsActive)
                        {
                            f.FamilyFunds = currentFunds;
                            f.UnpaidBills = currentUnpaidBills;
                        }

                        f.IsActive = false;
                        ApartmentController.SwitchActive(f, false);
                    }
                }

                //Household.ActiveHousehold.mh
                // HudModel hudModel = Sims3.UI.Responder.Instance.HudModel as HudModel;
            }
            catch (Exception ex)
            {
                CommonMethods.PrintMessage("LoadActiveHousehold: " + ex.Message);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a family and ads them as roommates. 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="familyFunds"></param>
        /// <param name="sims"></param>
        /// <param name="household"></param>
        /// <returns></returns>
        public static ApartmentFamily CreateFamily(string name, string familyFunds, string rent, List<SimDescription> sims, List<MinorPet> minorPets, Household household)
        {
            ApartmentFamily af = new ApartmentFamily();
            af.FamilyName = name;
            int.TryParse(familyFunds, out af.FamilyFunds);
            int.TryParse(rent, out af.Rent);

            household.SetFamilyFunds(household.FamilyFunds - af.FamilyFunds);

            af.Residents = sims;
            af.MinorPets = minorPets;

            return af;

        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a family and ads them as roommates.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="familyFunds"></param>
        /// <param name="sims"></param>
        /// <param name="household"></param>
        /// <returns></returns>
        public static ApartmentFamily CreateFamily(string name, string familyFunds, string rent, List <SimDescription> sims, List <MinorPet> minorPets, Household household)
        {
            ApartmentFamily af = new ApartmentFamily();

            af.FamilyName = name;
            int.TryParse(familyFunds, out af.FamilyFunds);
            int.TryParse(rent, out af.Rent);

            household.SetFamilyFunds(household.FamilyFunds - af.FamilyFunds);

            af.Residents = sims;
            af.MinorPets = minorPets;

            return(af);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Delete the selected family
        /// </summary>
        /// <param name="c"></param>
        /// <param name="f"></param>
        public static void DeleteFamily(Controller c, ApartmentFamily f)
        {
            if (f.Residents != null && f.Residents.Count > 0)
            {
                foreach (SimDescription item in f.Residents)
                {
                    if (item.IsNeverSelectable)
                    {
                        RemoveRoommate(item);
                    }
                }
            }

            //If not active family, join the funds
            if (!f.IsActive)
            {
                c.LotCurrent.Household.SetFamilyFunds(c.LotCurrent.Household.FamilyFunds + f.FamilyFunds);
            }

            c.Families.Remove(f);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Delete the selected family
        /// </summary>
        /// <param name="c"></param>
        /// <param name="f"></param>
        public static void DeleteFamily(Controller c, ApartmentFamily f)
        {
            if (f.Residents != null && f.Residents.Count > 0)
            {
                foreach (SimDescription item in f.Residents)
                {
                    if (item.IsNeverSelectable)
                        RemoveRoommate(item);
                }
            }

            //If not active family, join the funds 
            if (!f.IsActive)
                c.LotCurrent.Household.SetFamilyFunds(c.LotCurrent.Household.FamilyFunds + f.FamilyFunds);

            c.Families.Remove(f);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Switch the active family
        /// </summary>
        /// <param name="family"></param>
        /// <param name="isActive"></param>
        private static void SwitchActive(ApartmentFamily family, bool isActive)
        {
            if (isActive)
            {
                foreach (SimDescription s in family.Residents)
                {
                    //If this is true, this sim is a roommate
                    if (s.IsNeverSelectable)
                    {
                        RemoveRoommate(s);
                    }
                }

                foreach (MinorPet p in family.MinorPets)
                {
                    p.StartBehaviorSMC(true);
                }
            }
            else
            {
                foreach (SimDescription s in family.Residents)
                {
                    AddRoommate(s);
                }

                foreach (MinorPet p in family.MinorPets)
                {
                      p.StopBehaviorSMC();
                }
            }
        }
Ejemplo n.º 8
0
        public static void LoadActiveHousehold(ApartmentFamily activeFamily, Controller c)
        {
            try
            {
                //Clean the families first
                CleanupFamily(c);

                //Change active families
                int currentFunds = c.LotCurrent.Household.FamilyFunds;
                int currentUnpaidBills = c.LotCurrent.Household.UnpaidBills;

                //Handle the new active family first
                foreach (ApartmentFamily f in c.Families)
                {
                    if (f.FamilyId == activeFamily.FamilyId)
                    {
                        f.IsActive = true;
                        c.LotCurrent.Household.SetFamilyFunds(f.FamilyFunds);
                        c.LotCurrent.Household.UnpaidBills = f.UnpaidBills;
                        ApartmentController.SwitchActive(f, true);

                        break;

                    }
                }

                //Select the first sim in the active household
                if (activeFamily.Residents.Count > 0 && c.LotCurrent.Household.IsActive)
                {
                    PlumbBob.ForceSelectActor(activeFamily.Residents[0].CreatedSim);
                }

                //Make everybody else roommates
                foreach (ApartmentFamily f in c.Families)
                {
                    if (f.FamilyId != activeFamily.FamilyId)
                    {
                        //If this is the previous active family
                        if (f.IsActive)
                        {
                            f.FamilyFunds = currentFunds;
                            f.UnpaidBills = currentUnpaidBills;
                        }

                        f.IsActive = false;
                        ApartmentController.SwitchActive(f, false);
                    }
                }

                //Household.ActiveHousehold.mh
                // HudModel hudModel = Sims3.UI.Responder.Instance.HudModel as HudModel;


            }
            catch (Exception ex)
            {
                CommonMethods.PrintMessage("LoadActiveHousehold: " + ex.Message);
            }
        }