Пример #1
0
        /// <summary>
        /// Handle rent payments
        /// </summary>
        public static void RentAlarm()
        {
            try
            {
                List <Controller> cList = new List <Controller>(Sims3.Gameplay.Queries.GetObjects <Controller>());
                if (cList != null && cList.Count > 0)
                {
                    Controller activeController = cList.Find(delegate(Controller c) { return(c.LotCurrent.LotId == Household.ActiveHousehold.LotId); });
                    if (activeController != null)
                    {
                        ApartmentFamily af = activeController.Families.Find(delegate(ApartmentFamily f) { return(f.IsActive == true); });

                        if (af != null)
                        {
                            if (Household.ActiveHousehold.FamilyFunds >= af.Rent)
                            {
                                Household.ActiveHousehold.SetFamilyFunds(Household.ActiveHousehold.FamilyFunds - af.Rent);
                                CommonMethods.PrintMessage("Rent paid: " + af.Rent);
                            }
                            else
                            {
                                Household.ActiveHousehold.UnpaidBills += af.Rent;
                                CommonMethods.PrintMessage("Not enough money for rent. " + af.Rent + "§ added to unpaid bills.");
                            }
                        }
                    }

                    //CommonMethods.PrintMessage("Set Rent: " + );
                }
            }
            catch (System.Exception ex)
            {
                CommonMethods.PrintMessage("BillsCreted " + ex.Message);
            }
        }
Пример #2
0
        public override bool Run()
        {
            try
            {
                //Active Family
                if (base.SelectedObjects != null && base.SelectedObjects.Count > 0)
                {
                    ApartmentFamily selectedFamily = base.SelectedObjects[0] as ApartmentFamily;


                    if (selectedFamily != null)
                    {
                        ApartmentController.LoadActiveHousehold(selectedFamily, base.Target);
                        base.Target.StartUpOrSwitch();
                    }
                }
            }

            catch (System.Exception ex)
            {
                CommonMethods.PrintMessage("Interaction SetActiveFamily: " + ex.Message);
            }

            return(true);
        }
Пример #3
0
        /// <summary>
        /// Start up things when the game is loaded or a new controller is added
        /// </summary>
        public void StartUpOrSwitch()
        {
            try
            {
                //Only do this part for the active family
                if (this.LotCurrent.Household != null && this.LotCurrent.Household.IsActive)
                {
                    // List<Abstracts.Door> doors = ApartmentController.ReturnLockedDoors(this);

                    //set the active households rent
                    ApartmentFamily activeFamily = this.Families.Find(
                        delegate(ApartmentFamily f) { return(f.IsActive == true); });
                    if (activeFamily != null)
                    {
                        if (firstLoad)
                        {
                            firstLoad = false;

                            if (ControllerSettings.alwaysDisableRoommateService)
                            {
                                //Event Hanlders
                                World.OnAddLotPostLoadCallback += new System.EventHandler(World_OnWorldQuitEventHandler);

                                ApartmentController.StopAcceptingRoommates();
                            }
                            //  ApartmentController.LoadActiveHousehold(activeFamily, this);
                        }
                    }
                }

                //Handle rent payment
                DaysOfTheWeek   daysOfTheWeek = DaysOfTheWeek.None;
                DaysOfTheWeek[] array         = Mailbox.kBillingDaysOfWeek;
                for (int i = 0; i < array.Length; i++)
                {
                    DaysOfTheWeek daysOfTheWeek2 = array[i];
                    daysOfTheWeek |= daysOfTheWeek2;
                }

                if (this.mBills == AlarmHandle.kInvalidHandle)
                {
                    this.mBills = AlarmManager.Global.AddAlarmDay(ControllerSettings.timeOfRent, ControllerSettings.rentDay, new AlarmTimerCallback(RentAlarm), "anisBillAndRentAlarm", AlarmType.NeverPersisted, null);
                }
            }
            catch (System.Exception ex)
            {
                CommonMethods.PrintMessage("bill handling: " + ex.Message);
            }
        }
Пример #4
0
        public override bool Run()
        {
            ApartmentFamily af = this.Target.Families.Find(delegate(ApartmentFamily f) { return(f.IsActive == true); });

            if (af != null)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(CommonMethods.LocalizeString("FamilyName", new object[0]) + ": " + af.FamilyName);
                sb.Append("\n");
                sb.Append(CommonMethods.LocalizeString("Residents", new object[0]) + ": " + af.Residents.Count);
                sb.Append("\n");
                sb.Append(CommonMethods.LocalizeString("Rent", new object[0]) + ": " + af.Rent + " § ");

                CommonMethods.PrintMessage(sb.ToString());
            }

            return(true);
        }
Пример #5
0
        public override bool Run()
        {
            //Active Family
            if (base.SelectedObjects != null && base.SelectedObjects.Count > 0)
            {
                ApartmentFamily selectedFamily = base.SelectedObjects[0] as ApartmentFamily;
                try
                {
                    if (selectedFamily != null)
                    {
                        ApartmentController.DeleteFamily(base.Target, selectedFamily);
                        base.Target.StartUpOrSwitch();
                    }
                }
                catch (System.Exception ex)
                {
                    CommonMethods.PrintMessage(ex.Message);
                }
            }



            return(true);
        }
Пример #6
0
        public override bool Run()
        {
            //Active Family
            if (base.SelectedObjects != null && base.SelectedObjects.Count > 0)
            {
                ApartmentFamily selectedFamily = base.SelectedObjects[0] as ApartmentFamily;

                try
                {
                    if (selectedFamily != null)
                    {
                        if (selectedFamily.MinorPets == null)
                        {
                            selectedFamily.MinorPets = new List <MinorPet>();
                        }

                        selectedFamily.FamilyName = CommonMethods.ShowDialogue(CommonMethods.LocalizeString("FamilName", new object[0]), CommonMethods.LocalizeString("EditFamilyName", new object[0]), selectedFamily.FamilyName);

                        if (!string.IsNullOrEmpty(selectedFamily.FamilyName))
                        {
                            string tmp = CommonMethods.ShowDialogue(CommonMethods.LocalizeString("FamilyFunds", new object[0]), CommonMethods.LocalizeString("EditFamilyFunds", new object[0]), selectedFamily.FamilyFunds.ToString());

                            if (!string.IsNullOrEmpty(tmp))
                            {
                                int.TryParse(tmp, out selectedFamily.FamilyFunds);

                                tmp = CommonMethods.ShowDialogue(CommonMethods.LocalizeString("Rent", new object[0]), CommonMethods.LocalizeString("EditRent", new object[0]), selectedFamily.Rent.ToString());

                                if (!string.IsNullOrEmpty(tmp))
                                {
                                    int.TryParse(tmp, out selectedFamily.Rent);

                                    List <SimDescription> residents = new List <SimDescription>();

                                    List <PhoneSimPicker.SimPickerInfo> homeles          = CommonMethods.ShowHomelesSims(base.Actor, base.Target.LotCurrent, base.Target.Families);
                                    List <PhoneSimPicker.SimPickerInfo> currentResidents = CommonMethods.ShowResidentSims(base.Actor, selectedFamily.Residents);

                                    //Combine homeless and current, or current won't show up when removing.
                                    homeles.AddRange(currentResidents);

                                    List <PhoneSimPicker.SimPickerInfo> list3 = DualPaneSimPicker.Show(homeles, currentResidents, CommonMethods.LocalizeString("Residents", new object[0]), CommonMethods.LocalizeString("AvailableSims", new object[0]));
                                    if (list3 != null)
                                    {
                                        residents = list3.ConvertAll <SimDescription>(new Converter <PhoneSimPicker.SimPickerInfo, SimDescription>(CommonDoor.LockDoor.SimPickerInfoToSimDescription));
                                    }

                                    //residents = CommonMethods.ShowSimSelector(Actor, Target.LotCurrent.Household, "Select Sims for Family: ");
                                    if (residents != null)
                                    {
                                        selectedFamily.Residents = residents;
                                    }

                                    //Minor Pets
                                    List <MinorPet> minorPetList = new List <MinorPet>();
                                    if (CommonMethods.ReturnMinorPets(this.Target).Count > 0)
                                    {
                                        List <ObjectPicker.RowInfo> homelessPets = CommonMethods.ReturnMinorPetsAsRowInfo(CommonMethods.ReturnHomelessPets(this.Target));
                                        List <ObjectPicker.RowInfo> currentPets  = CommonMethods.ReturnMinorPetsAsRowInfo(selectedFamily.MinorPets);

                                        //Combine homeless and current, or current won't show up when removing.
                                        homelessPets.AddRange(currentPets);

                                        List <ObjectPicker.RowInfo> list4 = DualPanelMinorPets.Show(homelessPets, currentPets, CommonMethods.LocalizeString("ResidentPets", new object[0]), CommonMethods.LocalizeString("AvailableMinorPets", new object[0]));

                                        if (list4 != null)
                                        {
                                            foreach (var item in list4)
                                            {
                                                minorPetList.Add(item.Item as MinorPet);
                                            }

                                            selectedFamily.MinorPets = minorPetList;
                                        }
                                    }

                                    base.Target.StartUpOrSwitch();
                                }
                            }
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    CommonMethods.PrintMessage(ex.Message);
                }
            }

            return(true);
        }