Ejemplo n.º 1
0
        protected override bool Allow(Lot lot)
        {
            if (lot.LotType != LotType.Residential)
            {
                IncStat("Not Residential");
                return(false);
            }
            else if ((!GetValue <Option, bool>()) && ((Sim.ActiveActor == null) || (lot != Sim.ActiveActor.LotHome)))
            {
                IncStat("Inactive Denied");
                return(false);
            }

            Household house = lot.Household;

            if (house != null)
            {
                if (SimTypes.IsSpecial(house))
                {
                    IncStat("Special");
                    return(false);
                }
                else if (!Money.Allow(this, SimTypes.HeadOfFamily(house)))
                {
                    IncStat("Money Denied");
                    return(false);
                }
            }

            return(base.Allow(lot));
        }
Ejemplo n.º 2
0
        protected override bool CommonAllow(SimDescription sim)
        {
            if (sim.ChildOrBelow)
            {
                IncStat("Too Young");
                return(false);
            }
            else if (sim.CreatedSim == null)
            {
                IncStat("Hibernating");
                return(false);
            }
            else if (sim.LotHome == null)
            {
                IncStat("Homeless");
                return(false);
            }
            else if (!Skills.Allow(this, sim))
            {
                IncStat("Skill Denied");
                return(false);
            }
            else if (!Money.Allow(this, sim))
            {
                IncStat("Money Denied");
                return(false);
            }

            return(base.CommonAllow(sim));
        }
Ejemplo n.º 3
0
        protected override bool Allow(SimDescription sim)
        {
            if (sim.CreatedSim == null)
            {
                IncStat("Hibernating");
                return(false);
            }
            else if (sim.LotHome == null)
            {
                IncStat("Not Resident");
                return(false);
            }
            else if (sim.ToddlerOrBelow)
            {
                IncStat("Too Young");
                return(false);
            }
            else if (Maximum <= 0)
            {
                IncStat("No Maximum");
                return(false);
            }
            else if (!Money.Allow(this, sim))
            {
                IncStat("User Denied");
                return(false);
            }
            else if (SimTypes.IsSpecial(sim))
            {
                IncStat("Special");
                return(false);
            }

            return(base.Allow(sim));
        }
Ejemplo n.º 4
0
        protected override bool Allow(SimDescription sim)
        {
            if (sim.CreatedSim == null)
            {
                IncStat("Hibernating");
                return(false);
            }
            else if (sim.ChildOrBelow)
            {
                IncStat("Too Young");
                return(false);
            }
            else if (sim.Household == null)
            {
                IncStat("No Home");
                return(false);
            }
            else if (SimTypes.IsSpecial(sim))
            {
                IncStat("Special");
                return(false);
            }
            else if (!Money.Allow(this, sim))
            {
                IncStat("User Denied");
                return(false);
            }
            else if (AddScoring("CollectDeeds", sim) <= 0)
            {
                IncStat("Score Fail");
                return(false);
            }

            return(base.Allow(sim));
        }
Ejemplo n.º 5
0
        protected override bool Allow(Household house)
        {
            SimDescription head = SimTypes.HeadOfFamily(house);

            if (head == null)
            {
                IncStat("No Head");
                return(false);
            }
            else if (!Money.Allow(this, head))
            {
                IncStat("Money Denied");
                return(false);
            }
            else if ((GetValue <TransferAmountOption, int>(house) == 0) && (GetValue <TransferPercentOption, int>(house) == 0))
            {
                IncStat("No Transfer");
                return(false);
            }
            else if (GetValue <TransferHouseholdOption, ulong>(house) == house.HouseholdId)
            {
                IncStat("Same House");
                return(false);
            }

            return(base.Allow(house));
        }
Ejemplo n.º 6
0
        protected override bool Allow(SimDescription sim)
        {
            if (Deaths.IsDying(sim))
            {
                IncStat("Dying");
                return(false);
            }
            else if (sim.Household == null)
            {
                IncStat("No Home");
                return(false);
            }
            else if (!Households.AllowGuardian(sim))
            {
                IncStat("Too Young");
                return(false);
            }
            else if (sim.Genealogy == null)
            {
                IncStat("No Gene");
                return(false);
            }
            else if (!Money.Allow(this, sim))
            {
                IncStat("User Denied");
                return(false);
            }
            else if (sim.TraitManager.HasElement(TraitNames.NoBillsEver))
            {
                IncStat("No Bills");
                return(false);
            }

            return(base.Allow(sim));
        }
Ejemplo n.º 7
0
        protected override bool CommonAllow(SimDescription sim)
        {
            if (!Money.Allow(this, sim))
            {
                IncStat("User Denied");
                return(false);
            }
            else if (sim.ToddlerOrBelow)
            {
                IncStat("Too Young");
                return(false);
            }
            else if (sim.Household == null)
            {
                IncStat("Homeless");
                return(false);
            }
            else if (SimTypes.IsService(sim))
            {
                IncStat("Service");
                return(false);
            }

            return(base.CommonAllow(sim));
        }
Ejemplo n.º 8
0
        protected override bool Allow(Household house)
        {
            if (!Money.Allow(this, SimTypes.HeadOfFamily(house)))
            {
                IncStat("User Denied");
                return(false);
            }

            return(base.Allow(house));
        }
Ejemplo n.º 9
0
        protected override bool CommonAllow(SimDescription sim)
        {
            if (!Money.Allow(this, sim))
            {
                IncStat("Money Denied");
                return(false);
            }

            return(base.CommonAllow(sim));
        }
Ejemplo n.º 10
0
        protected override bool Allow(SimDescription sim)
        {
            if (sim.CreatedSim == null)
            {
                IncStat("Hibernating");
                return(false);
            }
            else if (Deaths.IsDying(sim))
            {
                IncStat("Dying");
                return(false);
            }
            else if (sim.Household == null)
            {
                IncStat("No Home");
                return(false);
            }
            else if ((sim.FamilyFunds - MinimumWealth) < 0)
            {
                IncStat("No Money");
                return(false);
            }
            else if (!Households.AllowGuardian(sim))
            {
                IncStat("Too Young");
                return(false);
            }
            else if (SimTypes.IsSpecial(sim))
            {
                IncStat("Special");
                return(false);
            }
            else if (!GetValue <AllowPurchaseDeedsOption, bool>(sim))
            {
                IncStat("Purchase Denied");
                return(false);
            }
            else if (!Money.Allow(this, sim))
            {
                IncStat("Money Denied");
                return(false);
            }
            else if (!TestScoring(sim))
            {
                IncStat("Score Fail");
                return(false);
            }
            else if (sim.Household.RealEstateManager == null)
            {
                IncStat("No Manager");
                return(false);
            }

            return(base.Allow(sim));
        }
Ejemplo n.º 11
0
        protected override bool Allow(SimDescription sim)
        {
            if (sim.CreatedSim == null)
            {
                IncStat("Hibernating");
                return(false);
            }
            else if (sim.LotHome == null)
            {
                IncStat("Not Resident");
                return(false);
            }
            else if (sim.ToddlerOrBelow)
            {
                IncStat("Too Young");
                return(false);
            }
            else if (Deaths.IsDying(sim))
            {
                IncStat("Dying");
                return(false);
            }
            else if (!Sims.AllowInventory(this, sim, AllowActive ? Managers.Manager.AllowCheck.None : Managers.Manager.AllowCheck.Active))
            {
                IncStat("Inventory Denied");
                return(false);
            }
            else if (!Money.Allow(this, sim))
            {
                IncStat("Money Denied");
                return(false);
            }
            else if (SimTypes.IsSpecial(sim))
            {
                IncStat("Special");
                return(false);
            }
            else if ((Funds - Minimum) < 0)
            {
                AddStat("No Money Funds", Funds);
                AddStat("No Money Minimum", Minimum);
                return(false);
            }
            else if (GetValue <DebtOption, int>(sim.Household) > 0)
            {
                IncStat("Debt");
                return(false);
            }

            return(base.Allow(sim));
        }
Ejemplo n.º 12
0
        public bool AdjustFunds(SimDescription sim, string key, int funds)
        {
            if (sim == null)
            {
                return(false);
            }

            if (!Money.Allow(this, sim))
            {
                return(false);
            }

            return(AdjustFunds(sim.Household, key, funds));
        }
Ejemplo n.º 13
0
        protected override bool CommonAllow(SimDescription sim)
        {
            if (sim.CreatedSim == null)
            {
                IncStat("Hibernating");
                return(false);
            }
            else if (!Money.Allow(this, sim))
            {
                IncStat("Money Denied");
                return(false);
            }
            else if (!Situations.Allow(this, sim))
            {
                IncStat("Situation Denied");
                return(false);
            }

            return(base.CommonAllow(sim));
        }
Ejemplo n.º 14
0
        protected override bool Allow(SimDescription sim)
        {
            if (sim.ChildOrBelow)
            {
                IncStat("Too Young");
                return(false);
            }
            else if (sim.CreatedSim == null)
            {
                IncStat("Hibernating");
                return(false);
            }
            else if (sim.Household == null)
            {
                IncStat("No Home");
                return(false);
            }
            else if (sim.SkillManager == null)
            {
                IncStat("No Manager");
                return(false);
            }
            else if (!Skills.Allow(this, sim))
            {
                IncStat("Skill Denied");
                return(false);
            }
            else if (!Money.Allow(this, sim))
            {
                IncStat("Money Denied");
                return(false);
            }
            else if ((sim.IsEP11Bot) && (!sim.HasTrait(TraitNames.ArtisticAlgorithmsChip)))
            {
                IncStat("Chip Denied");
                return(false);
            }

            return(base.Allow(sim));
        }
Ejemplo n.º 15
0
        protected override bool Allow(Household house)
        {
            //if (!base.Allow(house)) return false;

            if (house != Household.ActiveHousehold)
            {
                if (!Money.ProgressionEnabled)
                {
                    return(false);
                }

                if (!GetValue <UnifiedBillingOption, bool>())
                {
                    return(false);
                }

                if (!Money.Allow(this, SimTypes.HeadOfFamily(house)))
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 16
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            List <SimDescription> parents = new List <SimDescription>();

            foreach (SimDescription parent in Relationships.GetParents(Sim))
            {
                if (SimTypes.IsDead(parent))
                {
                    continue;
                }

                if (!parent.Elder)
                {
                    continue;
                }

                if (parent.Household == Sim.Household)
                {
                    continue;
                }

                if (!ManagerFriendship.AreFriends(Sim, parent))
                {
                    continue;
                }

                if (GetValue <NetWorthOption, int>(parent.Household) >= GetValue <NetWorthOption, int>(Sim.Household))
                {
                    IncStat("Unnecessary");
                    continue;
                }

                parents.Add(parent);
            }

            if (parents.Count == 0)
            {
                return(false);
            }

            if (AddScoring("CaresAboutChildren", GetValue <AlimonyChanceOption, int>(Sim), ScoringLookup.OptionType.Chance, Sim) <= 0)
            {
                return(false);
            }

            int perParentPayment = GetValue <PaymentOption, int>();

            if (GetValue <IsRichOption, bool>(Sim.Household))
            {
                perParentPayment *= GetValue <AlimonyScenario.RichMultipleOption, int>();
            }

            foreach (SimDescription parent in parents)
            {
                if (!Money.Allow(this, parent, Managers.Manager.AllowCheck.None))
                {
                    IncStat("Money Denied Parent");
                    continue;
                }

                int payment = perParentPayment;
                if (Sim.FamilyFunds < payment)
                {
                    payment = Sim.FamilyFunds;
                }

                mTotalPayments += payment;

                if (payment == 0)
                {
                    IncStat("Insufficient");
                }
                else
                {
                    Money.AdjustFunds(Sim, "ElderSupport", -payment);

                    Money.AdjustFunds(parent, "ElderSupport", payment);

                    AddStat("Paid", payment);
                }
            }

            return(mTotalPayments > 0);
        }
Ejemplo n.º 17
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            SimDescription head = SimTypes.HeadOfFamily(House);

            Household lotOwner = Money.GetDeedOwner(House.LotHome);

            if ((lotOwner != null) && (lotOwner != House))
            {
                if (Money.Allow(this, SimTypes.HeadOfFamily(lotOwner)))
                {
                    int rent = (int)(ManagerLot.GetUnfurnishedLotCost(House.LotHome, 0) * GetValue <RentMultipleOption, int>(head) / 100f);
                    if (rent != 0)
                    {
                        Money.AdjustFunds(House, "Rent", -rent);
                        Money.AdjustFunds(lotOwner, "Rent", rent);
                    }
                }
            }

            int owed = 0;

            bool shouldBill = Money.ShouldBillHouse(House);

            if (shouldBill)
            {
                if (House.LotHome == null)
                {
                    return(false);
                }

                if (SimTypes.IsSpecial(House))
                {
                    return(false);
                }

                float standardTaxRate = GetValue <TaxRateOption, int>(head);
                if (!House.LotHome.IsApartmentLot)
                {
                    owed += (int)(ComputeNetWorthOfObjectsInHousehold(House, true) * standardTaxRate / 100f);
                }

                int valueOfAllVacationHomes = House.RealEstateManager.GetValueOfAllVacationHomes();
                owed += (int)Math.Round(valueOfAllVacationHomes * RealEstateManager.kPercentageOfVacationHomeValueBilled);

                Dictionary <int, List <float> > dictionary = new Dictionary <int, List <float> >();
                foreach (IReduceBills bills in House.LotHome.GetObjects <IReduceBills>())
                {
                    List <float> list;
                    int          key  = bills.ReductionArrayIndex();
                    float        item = bills.PercentageReduction();
                    if (dictionary.TryGetValue(key, out list))
                    {
                        list.Add(item);
                    }
                    else
                    {
                        List <float> list2 = new List <float>();
                        list2.Add((float)bills.MaxNumberContributions());
                        list2.Add(item);
                        dictionary.Add(key, list2);
                    }
                }

                foreach (KeyValuePair <int, List <float> > pair in dictionary)
                {
                    int num5 = (int)pair.Value[0];
                    pair.Value.RemoveAt(0);
                    pair.Value.Sort();
                    int count = pair.Value.Count;
                    num5 = Math.Min(num5, count);
                    float num7 = 0f;
                    for (int i = 1; i <= num5; i++)
                    {
                        num7 += pair.Value[count - i];
                    }
                    int amount = (int)(owed * num7);

                    try
                    {
                        House.MoneySaved(pair.Key, (uint)amount);
                    }
                    catch
                    {
                        if ((House.mMoneySaved == null) || (House.mMoneySaved.Length != 3))
                        {
                            House.mMoneySaved = new uint[3];
                        }
                    }

                    owed -= amount;
                }
            }

            bool debtRepayed = false;

            int loanPayment = 0;

            if ((House == Household.ActiveHousehold) && (GetValue <UnifiedBillingOption, bool>()))
            {
                int debt = GetValue <DebtOption, int>(House);

                if (debt > 0)
                {
                    int debtPaydown = 0;

                    float percent = GetValue <DebtPayDownScenario.ActivePercentOption, int>();
                    if (percent > 0)
                    {
                        debtPaydown = (int)(debt * (percent / 100f));
                        if (debtPaydown == 0)
                        {
                            debtPaydown = debt;
                        }
                    }
                    else
                    {
                        debtPaydown = GetValue <DebtPayDownScenario.ActiveOption, int>();
                    }

                    if (debt > debtPaydown)
                    {
                        AddStat("Paydown", debtPaydown);

                        loanPayment = debtPaydown;

                        owed += debtPaydown;

                        AddValue <DebtOption, int>(House, -debtPaydown);
                    }
                    else
                    {
                        AddStat("Paydown", debt);

                        loanPayment = debt;

                        owed += debt;

                        SetValue <DebtOption, int>(House, 0);

                        debtRepayed = true;
                    }
                }
            }

            AddStat("Owed", owed);

            if ((House != Household.ActiveHousehold) || ((GetValue <AutoActiveBillingOption, bool>()) && (Money.ProgressionEnabled)))
            {
                Money.AdjustFunds(House, "PayLoan", -loanPayment);

                Money.AdjustFunds(House, "Bills", -(owed - loanPayment));

                if ((debtRepayed) && (GetValue <DebtOption, int>(House) == 0))
                {
                    Stories.PrintStory(Households, "NoMoreDebt", House, null, ManagerStory.StoryLogging.Full);
                }
            }
            else
            {
                if (shouldBill)
                {
                    owed += (int)House.UnpaidBills;
                }

                if (owed != 0x0)
                {
                    if (Sims3.SimIFace.Environment.HasEditInGameModeSwitch)
                    {
                        AddValue <DebtOption, int>(House, owed);
                        House.UnpaidBills = 0;
                    }
                    else if (HouseholdsEx.NumSims(House) > 0x0)
                    {
                        Bill bill = GlobalFunctions.CreateObjectOutOfWorld("Bill") as Bill;
                        if (bill != null)
                        {
                            bill.Amount       = (uint)owed;
                            House.UnpaidBills = 0;
                            Mailbox mailboxOnLot = Mailbox.GetMailboxOnLot(House.LotHome);
                            if (mailboxOnLot != null)
                            {
                                mailboxOnLot.AddMail(bill, false);
                                bill.OriginatingHousehold = House;
                                Mailbox.AddJunkMail(mailboxOnLot);
                            }
                        }
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 18
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            List <SimDescription> children = new List <SimDescription>();

            int chance = GetValue <AlimonyChanceOption, int>(Sim);

            foreach (SimDescription child in Relationships.GetChildren(Sim))
            {
                if (GetValue <ForTeensOption, bool>())
                {
                    if (child.YoungAdultOrAbove)
                    {
                        continue;
                    }
                }
                else
                {
                    if (child.TeenOrAbove)
                    {
                        continue;
                    }
                }

                if (SimTypes.IsDead(child))
                {
                    continue;
                }

                if (child.IsMarried)
                {
                    continue;
                }

                if (child.Household == Sim.Household)
                {
                    continue;
                }

                if (GetValue <NetWorthOption, int>(child.Household) >= GetValue <NetWorthOption, int>(Sim.Household))
                {
                    IncStat("Unnecessary");
                    continue;
                }

                if (!GetValue <ForAdoptedOption, bool>())
                {
                    List <SimDescription> parents = Relationships.GetParents(child);

                    bool found = false;
                    foreach (SimDescription member in CommonSpace.Helpers.Households.All(child.Household))
                    {
                        if (parents.Contains(member))
                        {
                            found = true;
                        }
                    }

                    if (!found)
                    {
                        IncStat("Child Adopted");
                        continue;
                    }
                }

                children.Add(child);
            }

            if (children.Count == 0)
            {
                return(false);
            }

            int perChildPayment = GetValue <PaymentOption, int>();

            if (GetValue <IsRichOption, bool>(Sim.Household))
            {
                perChildPayment *= GetValue <RichMultipleOption, int>();
            }

            if (AddScoring("CaresAboutChildren", chance, ScoringLookup.OptionType.Chance, Sim) <= 0)
            {
                foreach (SimDescription child in children)
                {
                    if (RandomUtil.RandomChance(GetValue <PropagationChanceOption, int>()))
                    {
                        Add(frame, new PropagateAlimonyFailScenario(child, Sim), ScenarioResult.Start);
                    }
                }

                AddValue <AlimonyLapsesOption, int>(Sim, 1);

                if ((GetValue <AlimonyJailOption, bool>()) && (RandomUtil.RandomChance(GetValue <AlimonyLapsesOption, int>(Sim) * 10)))
                {
                    Add(frame, new GoToJailScenario(Sim, "AlimonyJail", perChildPayment), ScenarioResult.Start);

                    SetValue <AlimonyLapsesOption, int>(Sim, 0);
                }

                Add(frame, new SuccessScenario(), ScenarioResult.Start);
                return(true);
            }
            else
            {
                SetValue <AlimonyLapsesOption, int>(Sim, 0);
            }

            foreach (SimDescription child in children)
            {
                if (!Money.Allow(this, child, Managers.Manager.AllowCheck.None))
                {
                    IncStat("Money Denied Child");
                    continue;
                }

                int payment = perChildPayment;
                if (Sim.FamilyFunds < payment)
                {
                    payment = Sim.FamilyFunds;
                }

                mTotalPayments += payment;

                if (payment == 0)
                {
                    IncStat("Insufficient");
                }
                else
                {
                    Money.AdjustFunds(Sim, "ChildSupport", -payment);

                    Money.AdjustFunds(child, "ChildSupport", payment);

                    AddStat("Paid", payment);
                }
            }

            return(mTotalPayments > 0);
        }