Exemple #1
0
        public List <CasteOptions> GetMatching(SimDescription sim, int netWorth)
        {
            List <CasteOptions> results = new List <CasteOptions>();

            SimData simData = GetData(sim);

            if (simData.GetValue <AllowCasteOption, bool>())
            {
                List <ulong> manualCastes = simData.GetValue <ManualCasteOption, List <ulong> >();

                foreach (CasteOptions caste in Options.AllCastes)
                {
                    if (manualCastes.Contains(caste.ID))
                    {
                        results.Add(caste);
                    }
                    else if (caste.GetValue <CasteAutoOption, bool>())
                    {
                        if (caste.Matches(sim, netWorth))
                        {
                            results.Add(caste);
                        }
                    }
                }

                results.Sort(CasteOptions.SortByPriority);
            }

            // aye, adding another simData check here seems to cause this to explode...

            return(results);
        }
Exemple #2
0
        protected static bool OnPrivateAllow(Common.IStatGenerator stats, SimData settings, Managers.Manager.AllowCheck check)
        {
            if (!settings.GetValue <AllowSkillOption, bool>())
            {
                stats.IncStat("Allow: Skills Denied");
                return(false);
            }
            else if (!settings.GetValue <AllowPushSkillOption, bool>())
            {
                stats.IncStat("Allow: Push Denied");
                return(false);
            }

            return(true);
        }
Exemple #3
0
        protected override bool PrivateAllow(IScoringGenerator stats, SimDescription sim, SimData settings, AllowCheck check)
        {
            if (sim.Household != null)
            {
                if (SimTypes.IsTourist(sim))
                {
                    stats.IncStat("Allow: Tourist");
                    return(false);
                }

                if (sim.Household.IsTravelHousehold)
                {
                    stats.IncStat("Allow: Travel Household");
                    return(false);
                }
            }

            if (!settings.GetValue <AllowMoveFamilyOption, bool>())
            {
                stats.IncStat("Allow: Move Denied");
                return(false);
            }

            return(true);
        }
            protected static bool OnDualAllow(Common.IStatGenerator stats, SimData actorData, SimData targetData, Managers.Manager.AllowCheck check)
            {
                ulong id = actorData.GetValue <ArrangedMarriageOption, ulong>();

                if (id != 0)
                {
                    if (targetData.SimDescription.SimDescriptionId != id)
                    {
                        stats.IncStat("Arranged");
                        return(false);
                    }
                }

                id = targetData.GetValue <ArrangedMarriageOption, ulong>();
                if (id != 0)
                {
                    if (actorData.SimDescription.SimDescriptionId != id)
                    {
                        stats.IncStat("Arranged");
                        return(false);
                    }
                }

                return(true);
            }
Exemple #5
0
        protected override bool PrivateAllow(IScoringGenerator stats, SimDescription sim, SimData settings, AllowCheck check)
        {
            if (SimTypes.IsSpecial(sim))
            {
                stats.IncStat("Allow: Special");
                return(false);
            }

            if (Household.RoommateManager != null)
            {
                if (Household.RoommateManager.IsNPCRoommate(sim))
                {
                    stats.IncStat("Allow: Roomie");
                    return(false);
                }
            }

            if (((check & AllowCheck.Scoring) != AllowCheck.Scoring) && !settings.GetValue <AllowMoneyOption, bool>())
            {
                stats.IncStat("Allow: Money Denied");
                return(false);
            }

            return(true);
        }
Exemple #6
0
            protected static bool Test(IScoringGenerator stats, SimData actorData, SimData targetData, Managers.Manager.AllowCheck check)
            {
                SimDescription actor  = actorData.SimDescription;
                SimDescription target = targetData.SimDescription;

                if (actor.Partner != null)
                {
                    int chance = actorData.GetValue <ChanceOfAdulteryOption, int>();
                    if (chance == 0)
                    {
                        stats.IncStat("Adultery Denied");
                        return(false);
                    }
                    else if (stats.AddScoring("FlirtyPartner", chance, ScoringLookup.OptionType.Chance, actor) <= 0)
                    {
                        stats.IncStat("Adultery Scoring Fail");
                        return(false);
                    }

                    chance = targetData.GetValue <ChanceOfLiaisonOption, int>();
                    if (chance == 0)
                    {
                        stats.IncStat("Liaison Denied");
                        return(false);
                    }
                    if (stats.AddScoring("FlirtyPartner", chance, ScoringLookup.OptionType.Chance, target) <= 0)
                    {
                        stats.IncStat("Liaison Scoring Fail");
                        return(false);
                    }
                }

                return(true);
            }
Exemple #7
0
        protected override bool PrivateAllow(IScoringGenerator stats, SimDescription sim, SimData settings, AllowCheck check)
        {
            if (!settings.GetValue <AllowCasteOption, bool>())
            {
                stats.IncStat("Allow: Caste Denied");
                return(false);
            }

            return(true);
        }
Exemple #8
0
        protected override bool PrivateAllow(IScoringGenerator stats, SimDescription sim, SimData settings, AllowCheck check)
        {
            bool testRomance = true;

            if ((sim.Household != null) && ((check & AllowCheck.UserDirected) == AllowCheck.None))
            {
                if (SimTypes.InServicePool(sim, ServiceType.GrimReaper))
                {
                    stats.IncStat("Allow: Reaper");
                    return(false);
                }

                if (sim.LotHome == null)
                {
                    if (!GetValue <NewcomerGoneScenario.AllowHomelessMoveInOptionV2, bool>())
                    {
                        stats.IncStat("Allow: Homeless Move In Denied");
                        return(false);
                    }
                }
            }
            else
            {
                if (SimTypes.IsService(sim))
                {
                    testRomance = false;
                }
            }

            if (sim.IsEP11Bot)
            {
                if (!sim.TraitManager.HasAnyElement(sFlirtChips))
                {
                    stats.IncStat("Allow: Missing Chips");
                    return(false);
                }
            }

            if (testRomance)
            {
                if (!settings.GetValue <AllowRomanceOption, bool>())
                {
                    stats.IncStat("Allow: Romance Denied");
                    return(false);
                }
            }

            return(true);
        }
Exemple #9
0
        protected override bool PrivateAllow(IScoringGenerator stats, SimDescription sim, SimData settings, AllowCheck check)
        {
            if (sim.Household == null)
            {
                stats.IncStat("Allow: No Home");
                return(false);
            }

            if (!settings.GetValue <AllowPregnancyParticipationOption, bool>())
            {
                stats.IncStat("Allow: Participation Denied");
                return(false);
            }

            return(true);
        }
Exemple #10
0
        protected override bool PrivateAllow(IScoringGenerator stats, SimDescription sim, SimData settings, AllowCheck check)
        {
            if (SimTypes.InServicePool(sim, ServiceType.GrimReaper))
            {
                stats.IncStat("Allow: Reaper");
                return(false);
            }

            if (!settings.GetValue <AllowFriendshipOption, bool>())
            {
                stats.IncStat("Allow: Friendship Denied");
                return(false);
            }

            return(true);
        }
Exemple #11
0
        protected override bool PrivateAllow(IScoringGenerator stats, SimDescription sim, SimData settings, AllowCheck check)
        {
            if (sim.LotHome == null)
            {
                stats.IncStat("Allow: Homeless");
                return(false);
            }

            if (!settings.GetValue <AllowPersonalityOption, bool>())
            {
                stats.IncStat("Allow: User Denied");
                return(false);
            }

            SimPersonality personality = stats as SimPersonality;

            if (personality == null)
            {
                IHasPersonality hasPersonality = stats as IHasPersonality;
                if (hasPersonality != null)
                {
                    personality = hasPersonality.Personality;
                }
                else
                {
                    Scenario scenario = stats as Scenario;
                    if (scenario != null)
                    {
                        personality = scenario.Manager as SimPersonality;
                    }
                }
            }

            if (personality == null)
            {
                Common.DebugStackLog(stats.GetType().ToString());
                //stats.IncStat("Allow: Incorrect Manager");
                //return false;
            }
            else if (settings.HasValue <DisallowPersonalityOption, SimPersonality>(personality))
            {
                stats.IncStat("Allow: Personality Denied");
                return(false);
            }

            return(true);
        }
Exemple #12
0
            protected static bool OnAllow(Common.IStatGenerator stats, SimData sim, Managers.Manager.AllowCheck check)
            {
                SimDescription simDesc = sim.SimDescription;

                if (!sim.GetValue <AllowBreakupOption, bool>())
                {
                    stats.IncStat("Allow: Breakup Denied");
                    return(false);
                }
                else if (!StoryProgression.Main.GetValue <AllowBreakupOption, bool>(simDesc.Partner))
                {
                    stats.IncStat("Allow: Breakup Partner Denied");
                    return(false);
                }

                return(true);
            }
Exemple #13
0
        protected static bool OnAllowSkill(Common.IStatGenerator stats, SimData settings, SkillNames skill)
        {
            if (settings.HasValue <DisallowSkillOption, SkillNames>(skill))
            {
                stats.IncStat("Allow: " + skill + " Denied");
                return(false);
            }
            else if (settings.GetValue <AllowOnlyExistingSkillOption, bool>())
            {
                if (settings.SimDescription.SkillManager.GetSkillLevel(skill) < 1)
                {
                    stats.IncStat("Allow: " + skill + " Only Existing Denied");
                    return(false);
                }
            }

            return(true);
        }
Exemple #14
0
        protected override bool PrivateAllow(IScoringGenerator stats, SimDescription sim, SimData settings, AllowCheck check)
        {
            if (!base.PrivateAllow(stats, sim, settings, check))
            {
                return(false);
            }

            if (SimTypes.IsDead(sim))
            {
                stats.IncStat("Allow: Dead");
                return(false);
            }

            if (sim.ChildOrBelow)
            {
                stats.IncStat("Allow: Too Young");
                return(false);
            }

            if (sim.IsPregnant)
            {
                stats.IncStat("Allow: Pregnant");
                return(false);
            }

            if (!sim.AgingEnabled)
            {
                stats.IncStat("Allow: Aging Disabled");
                return(false);
            }

            if (settings.GetValue <PushDeathChanceOption, int>() <= 0)
            {
                stats.IncStat("Allow: Sim Push Death Denied");
                return(false);
            }

            return(true);
        }
Exemple #15
0
        public override bool IsHit(SimScoringParameters parameters)
        {
            ManagerMoney money = StoryProgression.Main.Money;

            bool allow = false;

            using (NetWorthOption.CacheValue cache = new NetWorthOption.CacheValue(money, parameters.Actor.Household))
            {
                allow = money.Allow(money, parameters.Actor, true);
                if (allow)
                {
                    SimData data = StoryProgression.Main.GetData(parameters.Actor);
                    if (data != null)
                    {
                        if ((!data.GetValue <AllowMoneyOption, bool>()))
                        {
                            return(false);
                        }
                    }
                }

                return(allow);
            }
        }
Exemple #16
0
        protected override void PrivatePerform(SimDescription sim, SimData data, ScenarioFrame frame)
        {
            if (SimTypes.IsService(sim.Household))
            {
                return;
            }

            if (sim.LotHome == null)
            {
                return;
            }

            if (sim.AssignedRole != null)
            {
                if (sim.AssignedRole.IsActive)
                {
                    return;
                }
            }

            if (sim.CreatedSim == null)
            {
                return;
            }

            if (sim.CreatedSim.HasBeenDestroyed)
            {
                return;
            }

            if (sim.CreatedSim.Autonomy == null)
            {
                return;
            }

            Motives motives = sim.CreatedSim.Autonomy.Motives;

            if (motives == null)
            {
                return;
            }

            bool frozen = data.GetValue <StaticHungerOption, bool>();

            AlterDecay(motives.GetMotive(CommodityKind.VampireThirst), frozen);
            AlterDecay(motives.GetMotive(CommodityKind.Hunger), frozen);
            AlterDecay(motives.GetMotive(CommodityKind.BatteryPower), frozen);

            if (!sim.IsMummy)
            {
                frozen = data.GetValue <StaticEnergyOption, bool>();

                AlterDecay(motives.GetMotive(CommodityKind.Energy), frozen);
                AlterDecay(motives.GetMotive(CommodityKind.AlienBrainPower), frozen);

                frozen = data.GetValue <StaticBladderOption, bool>();

                AlterDecay(motives.GetMotive(CommodityKind.Bladder), frozen);
            }

            frozen = data.GetValue <StaticHygieneOption, bool>();

            if (!sim.IsFrankenstein)
            {
                AlterDecay(motives.GetMotive(CommodityKind.Hygiene), frozen);
            }

            AlterDecay(motives.GetMotive(CommodityKind.Maintenence), frozen);

            frozen = data.GetValue <StaticFunOption, bool>();

            AlterDecay(motives.GetMotive(CommodityKind.Fun), frozen);

            frozen = data.GetValue <StaticSocialOption, bool>();

            AlterDecay(motives.GetMotive(CommodityKind.Social), frozen);

            if (GameUtils.IsInstalled(ProductVersion.EP8))
            {
                frozen = data.GetValue <StaticTemperatureOption, bool>();

                AlterDecay(motives.GetMotive(CommodityKind.Temperature), frozen);
            }

            if (GameUtils.IsInstalled(ProductVersion.EP5))
            {
                switch (sim.Species)
                {
                case CASAgeGenderFlags.Horse:
                    frozen = data.GetValue <StaticExerciseOption, bool>();

                    AlterDecay(motives.GetMotive(CommodityKind.HorseExercise), frozen);

                    frozen = data.GetValue <StaticThirstOption, bool>();

                    AlterDecay(motives.GetMotive(CommodityKind.HorseThirst), frozen);
                    break;

                case CASAgeGenderFlags.Cat:
                    frozen = data.GetValue <StaticDestructionOption, bool>();

                    AlterDecay(motives.GetMotive(CommodityKind.CatScratch), frozen);
                    break;

                case CASAgeGenderFlags.Dog:
                case CASAgeGenderFlags.LittleDog:
                    frozen = data.GetValue <StaticDestructionOption, bool>();

                    AlterDecay(motives.GetMotive(CommodityKind.DogDestruction), frozen);

                    break;
                }
            }
        }
Exemple #17
0
 protected static bool OnAllowLiaison(IScoringGenerator stats, SimData simData, Managers.Manager.AllowCheck check)
 {
     return(simData.GetValue <ChanceOfLiaisonOption, int>() != 0);
 }
Exemple #18
0
 protected static bool OnAllowRent(Common.IStatGenerator stats, SimData settings, Managers.Manager.AllowCheck check)
 {
     return(settings.GetValue <RentableOption, bool>());
 }